C++ examples for Class:object
Declaring Arrays of Objects
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; class Employee//from w w w . ja v a 2s. c o m { public: int workHour; double salary; double addWork(int hours, double grade){ return 0.0; } }; void myFunction() { Employee s[10]; s[4].salary = 4.0; s[4].workHour = 32; s[4].addWork(3, 0.0); } int main(int nNumberofArgs, char* pszArgs[]) { myFunction(); cout<< "done."; return 0; }