C++ Interface

Interfaces in C++ (Abstract Classes)

Interfaces in C++ are basically the abstract classes that are used to achieve the abstraction in C++. It can be described as the process that is used to show the functionality only and hide the internal details. Generally there are two methods in which abstraction can be achieved:

Abstract class

Interface

The above mentioned methods can possess the abstract methods that are necessary for abstraction.

C++ Abstract class

A class in C++ is made to be abstract just by declaring one of its functions at least as <>strong> pure virtual function. A pure virtual function is generally specified by placing “=0” in its declaration. The derived class should have the implementation delivered by them.

Here is an example of the abstract class in C++ that consists of one abstract method and the implementation has been delivered by the classes, this example will help you understand the physical aspect of the abstract class: