What is pure virtual function in C++? tccicomputercoaching.com

Page 1

What is pure virtual function in C++? tccicomputercoaching.com A pure virtual function in C++ is like an "abstract method" in other languages -- it forces insatiable subclasses to provide an implementation of the method. A pure virtual method is an abstract method with no implementation that must be implemented by all subclasses of the owner class. It also refer that the owner class is an abstract class and one can't instantiate an object of it.

class base { virtual void show()=0; // pure virtual function }; class derived : public base { void show() { cout<<"child class implement pure virtual function"; } };


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.