[ create a new paste ] login | about

Link: http://codepad.org/vBE9XNyd    [ raw code | output | fork ]

C++, pasted on Sep 15:
#include <iostream>

class army                         // Class declaration
{
    int number_suffix;             //Member Variable
    string key;
    
    void enrollment(string name, int age)
    {key = name; number_suffix = age;}
    
    void retirement()             // Member Functions
    {cout << key << " is retiring";}
};

int main()
{
    army a1;                     // Object creation and Memory allocation

    a1.enrollment("Shirley", 31);
    a1.retirement();
    return 0; 
}


Output:
1
2
3
In function 'int main()':
Line 8: error: 'void army::enrollment(std::string, int)' is private
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: