top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

C++: What is the best way to create an interface in C++ ?

+1 vote

High level object oriented languages have support of interfaces. What is the best way to create interfaces in C++ ?

posted Oct 2, 2020 by Crazy

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If we declare a pure abstract class then that class would be considered as an Interface. A pure abstract class is a class in which all member functions are pure virtual. That means there is no implementation present in interface class and the class which is going to support (inheritance) that interface would implement (definition) each member function.
We can use struct/class both for defining an interface in C++.

answer Jan 29, 2021 by Vimal Kumar Mishra
Similar Questions
+1 vote

Want to know how to represent a Graph (V,E) in C/C++.

+2 votes

I know the definition of singleton class i.e. a class for which only one object can be defined or initialized. But I want to know all the possible ways to achieve this restriction.