home
clear breadcrumbs
search
login
 
class
#include
#include
using namespace std; class Employee { /* access modifiers : private: default modifier - members cannot be accessed (or viewed) from outside the class protected: members cannot be accessed from outside the class, however, they can be accessed in inherited classes public: members are accessible from outside the class */ public: // class members string name; string company; int age; // class method int employeeNumber() { return time(0); } }; int main() { // create object of type emp1 from class Employee Employee emp1; cout << "Enter employee name: "; cin >> emp1.name; cout << endl; cout << "---------------------------------------\n"; cout << endl; cout << endl; cout << "The new employee number: " << emp1.employeeNumber(); cout << endl; cout << "The new employee name: " << emp1.name;; cout << endl; cout << endl; cout << endl; // public class members }