#include class Sample { public: char* salutation; Sample(char* c) { //constructor if ((salutation=(char*)malloc(strlen(c)+1))==0) { cerr << "memory allocation error\n"; exit(1); } strcpy(salutation,c); }//end constructor Sample };//end class Sample Sample sample("hey"); // static object of class Sample // function main -------------------------------------- int main() { cout << sample.salutation << '\n'; return 0; }//end main