Listing 2
class Expressions01{ public: static void classMain(){ //Instantiate an object in dynamic memory // and save its reference in a pointer // variable. Note the use of the Indirection // operator, the new operator, and the // Assignment operator. Expressions01* ptrToObject = new Expressions01(); //Invoke an instance function on the object. // Note the use of the Pointer to Member // operator. ptrToObject -> doSomething(); }//End classMain function Listing 2 |