1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
#include <iostream> using namespace std; class Employee { public: Employee (string = "default", int = 10){} void display(); void set (string, int); int get (string&, int&); void fct(); private: static int x; static string s; }; int Employee::x=7; string Employee::s="Ligia"; void Employee::display() { cout << s << x << endl; } void Employee::set(string k, int n) { n++; x=n; s=k; } int Employee::get(string& k, int& n) { k=s+"k"; n=x+7; return n; } void Employee::fct() { s="tt"; x=x+7; } int main() { int num; string name; Employee e1; Employee e2("Rita", 13); e2.Employee::display(); e2.set("Veronica",25); e2.get(name, num); e2.Employee::display(); e2.fct(); e2.Employee::fct(); e2.Employee::display(); e1.Employee::fct(); e1.Employee::display(); return 0; }
#include<string>