Abstract base class & Pure virtual function in
c++
• Sometimes implementation of all functions cannot be provided in
a base class because we don’t know the implementation. Such a
class is called an abstract class.
• A pure virtual function (or abstract function) in C++ is a virtual
function for which we can have an implementation, But we must
override that function in the derived class, otherwise, the derived
class will also become an abstract class.
Abstract base class & Pure virtual fuction in
c++
Abstract base class & Pure virtual fuction in
c++
Abstract base class & Pure virtual fuction in
c++
Abstract base class & Pure virtual fuction in
c++
• If we do not override the pure virtual function in the derived
class, then the derived class also becomes an abstract class.
We can have pointers and references of abstract class type.
• If we do not override the pure virtual function in the derived
class, then the derived class also becomes an abstract class.
• An abstract class can have constructors.
• An abstract class in C++ can also be defined using struct
keyword.