Reference: http://www.weixueyuan.net/view/6376.htmlSummarize:In C + +, the common interface can be implemented by abstracting the base classA pure virtual member function has no function body, only a function declaration, and a "= 0" at the end of a
C + + pure virtual function detailed explanation
Sometimes specifying a member function as a virtual function in a base class is not a requirement for the base class itself, but rather a function name in the base class, given the needs of the
C ++ abstract class, abstract class
1. Pure virtual function definitionA pure virtual function is a virtual function declared in the base class. It is not defined in the base class, but any derived class must define its own implementation method. To
abstract class
editing
Abstract classes are often used to characterize the abstract concepts of analysis and design of problem areas, and are abstractions of a series of concrete concepts that look different, but are essentially the
1. destructor and virtual destructorIf the destructor of the base class is virtual, The destructor of its derived class are virtual.This will cause: When the derived class destructor, all of its basic class destructor will be called.Otherwise, only
First, The core idea of object-oriented programming (Object-oriented programming) is data abstraction, inheritance, dynamic binding . With data abstraction, you can decouple the interface of a class from implementation, use inheritance, and make it
Because both C + + and Java are object-oriented programming languages, their polymorphism is achieved by virtual functions and abstract functions, respectively.The virtual function of C + + can be overridden in subclasses, and the invocation is
Http://www.cnblogs.com/fly1988happy/archive/2012/09/25/2701237.html1. polymorphicIn object-oriented languages, many different implementations of interfaces are polymorphic. Polymorphism refers to an instance (object) of a child class with a pointer
First, pure virtual functions and abstract classes in C + +:1. A class containing one or more pure virtual functions becomes an abstract class, note that this is a pure virtual function, not a virtual function.2. If a subclass inherits an abstract
Definition of a pure virtual functionA pure virtual function is a virtual function declared in a base class that is not defined in the base class, but requires that any derived class define its own implementation method. The method of implementing a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.