C++ Pointer to Objects
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; class Employee//from w w w . j a v a2 s .c om { public: int workHour; double salary; double addWork(int hours, double grade){return 0.0;} }; int main(int argc, char* pArgs[]) { Employee s; s.salary = 3.0; Employee* pS; pS = &s; cout << "s.salary = " << s.salary << "\n" << "pS->salary = " << pS->salary << endl; return 0; }