What is pure virtual function and abstract class in C++?

A pure virtual function doesn’t have a definition in a base class. It is defined in a derived class. A pure virtual function must be overridden in a derived class.


virtual type function_name(parameter_list) = 0;

Abstract class is a class having at least one pure virtual function. Objects can’t be created for an abstract class.  However, pointers and references can be created for an abstract class. The use of abstract class is to derive more classes from it. They are also used for creating class libraries.

Leave a Reply