C++ examples for Class:object
Declaring Pointers to Objects
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; class Employee/*from w w w . j a v a 2s .c o m*/ { 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; }