What is the difference between an abstract class and an interface in C++? How do you implement an interface in C++?
Last updated
C++ has no
interfacekeyword. An abstract class has at least one pure virtual function (= 0) but may also hold data and implemented methods.An interface is a convention: a pure abstract class with only pure virtual functions, no data, and a
virtualdestructor.Implement one by publicly inheriting and overriding every pure virtual method. Multiple inheritance lets a class implement several interfaces.