#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 ~Sample() { free(salutation); } // destructor };//end class Sample // function doit ------------------------------------- void doit() { Sample sample("hey"); cout << sample.salutation << '\n'; }//end doit // function main -------------------------------------- int main() { while(1) doit(); return 0; }//end main