In the below code, the SHAPE class has a pure virtual function and is an abstract class (cannot be instantiated). Each class is derived from SHAPE implementing Draw () function in its own way. Further, each Draw function is virtual
What is a Pure Virtual Function? A pure virtual function (or abstract function) in C++ is a virtual function for which we don’t have an implementation, we only declare it. A pure virtual function is declared by assigning 0 in
Create Class Shape. Derived the class Triangle and class Rectangle. Create a draw function in each class. Demonstrate polymorphism by accessing draw function using pointers of Shape class.
What is Friend? A friend is Special One What is the difference between a friend and a non-friend? A friend has privileges to your private and protected stuff What is Friend Function A friend function in C++ is a