if you declared/defined a virtual function for a class and redefined it in a derived class so that when you call the derived class it calls its own version of the function and not the base class function , how do you call the base class function on the definition of the derived class?
rockerjhr
-3
Junior Poster in Training
Recommended Answers
Jump to PostI think this is what you want
#include <iostream> class m1 { public: virtual void display_it(void) const { std::cout << "from m1" << std::endl; } }; class m2:public m1 { public: void display_it(void) const { std::cout << "from m2" << std::endl; } }; int main(int argc, char** …
All 3 Replies
gerard4143
371
Nearly a Posting Maven
rockerjhr
-3
Junior Poster in Training
Fbody
682
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.