1
How you change a pointer from base class to derived class?
Hello, I have the following classes class Rock { public: Rock() { goldAmount = rand() % 100 + 1; price = 10; }; int revealContent() { return goldAmount; }; virtual void checkPrice() { cout << price << endl; }; protected: int price; private: int goldAmount; }; class ValuableRock : public Rock { public: ValuableRock() { [...]
Answer Question
| April 29, 2009 11:07 AM
C++, C++ classes, cast, Class, Classes, Derived class, Pointer
Hello, I have the following classes class Rock { public: Rock() { goldAmount = rand() % 100 + 1; price = 10; }; int revealContent() { return goldAmount; }; virtual void checkPrice() { cout << price << endl; }; protected: int price; private: int goldAmount; }; class ValuableRock : public Rock { public: ValuableRock() { [...]
1





