// Ex851.cc (derived from Ex752.cc <-- Ex643-correct.cc) // class Studenten is used // g++ -Wno-deprecated -Wall Ex851.cc studs.cc #include //#include "studenten.hh" #include "studs.hh" int main() { Studenten robbi; // Default constructor { // start block // Constructor with args Studenten arni("Arni", "Schwarz", 812, 7938592); robbi = arni; // Assignment operator } // end block // Destructor for arni // --------------------------------------------------------------- // Let us allocate in init some tiny dynamic array char *tiny; tiny = new char [5]; strcpy(tiny,"tiny"); //--------------------------------------------------------------------- cout << "robbi : " << robbi << endl; Studenten mike(robbi); // Copy constructor cout << "mike : " << mike << endl; mike.Print(cout); cout << endl; // Data in Studenten are public therefore: cout << "Access to public data : "; cout << "mike.pvorname = " << mike.pvorname << endl; return 0; } // Destructor for robbi, mike