Usage:In abstract class mode, a class can have its own data member, or it can have a non-abstract member method, and in the implementation of the interface method, the class can only have static data members that cannot be modified (that is, must be
One, polymorphic1. Polymorphism exists in inheritance and interfaces.2. The indeterminate behavior is placed in the parent class.3. Subclasses must override the indeterminate behavior in the parent class.Second, abstract class1. Keyword
Super Keyword:When the parent class is overridden, the subclass object cannot access the overridden method of the parent class, and super is to solve the problem:1. Use the Super keyword to access the member variables and member methods of the
1, the use of the interface is through the keyword implements. The use of abstract classes is through the keyword extends. Of course the interface can also be inherited by the keyword extends.2. You cannot declare member variables (including class
difference:
1, the use of the interface is through the keyword implements. The use of abstract classes is extends by keyword. Of course, interfaces can also be inherited by keyword extends.
2. You cannot declare member variables (including class
Encapsulation: is to encapsulate some attributes and methods into a class.
Inheritance: Just as subclasses inherit some of the properties and methods of the parent class.
Polymorphism: Just as a parent class has several distinct subclasses.
Here I
This article introduces abstract classes, interfaces, and a technology called contractual programming. Using these OPP mechanisms, the code is not limited to computing or output content. These mechanisms can define the interaction rules between
1. Final keywords
Final keywords can be used to modify classes, methods, and member variables.
(1) classes marked by final cannot be inherited;
(2) The final flag method cannot be subscribe;
(3) variables marked by final become constants and can
1. Definition of abstract class 1.1 abstract class
The class modified with abstract is an abstract class. The example is as follows:
Public abstract class test {// abstract class definition public abstract void doitbyhand (); // abstract method
Class that contains the abstract modifier is an abstract class, an instance object that the abstract class cannot create. A class that contains an abstract method must be defined as a method in the abstract Class,abstract class classes that does not
1. Abstract class
The abstract class mechanism always defines a common base class, and the specific details are left to the successor to implement. Abstract concepts allow you to create an extensible architecture in your development project. Any
Actually write this articleArticleMy own ideas are not so reliable, but I want to write my own ideas. The theme is of course inheritance.
As we all know, C # does not support multiple inheritance. A class can only inherit one parent class at the
Internal classClass within the class1. Solve multiple inheritance2. resolves conflicts between methods during inheritance and interface implementation3. Data Hiding Only internal classes can have four types of access ModifiersWhen the internal class
Abstract class:1) Abstract methods, only the concept of behavior, no specific behavior to achieve.Used: The abstract keyword is decorated, and there is no method body.2) A class that contains an abstract method must be an abstract class.Use:
Use and definition of PHP abstract classes & lt ;? Phpshortactclassa {public $ name; functionfun () {echo $ this-& gt; name;} abstractfunctioncc ($ n, $ nn = 3);} classBextendsA {functioncc ($ m, $ Use and definition of PHP abstract classesName;}
First, you must understand what is an abstract class:I. concept:In the concept of object-oriented, we know that all objects are depicted through classes, but this is not the case.Not all classes are used to depict objects. If a class does not
Abstract class and interface, abstract class Interface1 abstract class 1.1 abstract class overview
In java, a method without a method body should be defined as an abstract method. If an abstract method exists in a class, this class must be defined
1. Abstract class 1.1 Abstract class conceptsWhen some methods of the parent class are not deterministic, you can use the abstract keyword to decorate the method [abstract method] and use abstract to decorate the class [abstract class]. //the
java– virtual functions, abstract functions, abstract classes, interfaces
1. Java virtual functions
The existence of virtual functions is for polymorphism.
C + + Ordinary member function plus virtual keyword becomes virtual function
In Java, there
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.