What is an interface? An interface is a mechanism that defines the methods to be implemented by the class and the feature labels of these methods. If ianimal is an interface, while cdog is a class with an interface ianimal in advance, the cdog must implement the interface declaration and method. therefore, the interface is equivalent to a convention, and the class implementing the interface must comply with the Convention.
How does C ++ implement interfaces?
The C ++ interface is an abstract base class that only contains pure virtual functions.
The class that inherits the abstract base class must implement the pure virtual function it declares and use the specified feature mark. if the derived class is also an abstract class, the pure virtual function of the base class is not fully implemented after the previous "inherit pure virtual function.
Author: Lin yufei
Source: http://www.cnblogs.com/zhengyuhong/
The copyright of this article is shared by the author and the blog Park. You are welcome to repost it. However, you must keep the author's information without the author's consent and provide the original article connection clearly on the article page.