



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concepts of virtual functions and inheritance in C++ programming. It covers the differences between pure virtual functions, simple virtual functions, and non-virtual functions, and their respective purposes. It also includes a C++ tip about redefining inherited non-virtual functions and the consequences of doing so.
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




class Shape { public: virtual void draw() const = 0; virtual void error(const string &msg); … .. } class Rectangle: public Shape { …. };
D x; // x is an object of type D B *pB = &x; // pB is pointer to x pB->mf(); // call mf through pointer D *pD = &x; // pD is pointer to x pD->mf(); // call mf through pointer