CSS is the abbreviation for Cascading style sheets (cascading style Sheets), whose specifications represent a unique development phase in internet history. Now for the web-making friends, rarely have heard of CSS, because in the process of making
Flash's ActionScript 3.0
1, add up Flash (1)-ActionScript 3.0 basic data types, operators and Process Control statements
Introduced
All data types in Flash ActionScript 3.0 are objects, and the syntax of the operators and Process control
5. Polymorphism (polymorphism)
5.1 The concept of polymorphism
Three main characteristics of object-oriented: encapsulation, inheritance, polymorphism. From a certain point of view, encapsulation and inheritance are almost always prepared for
Inheritance (inheritance) and dynamic binding are an important component of object-oriented, that is, inheritance (inheritance) and polymorphism (polymorphism),
You can make a derived class (derived class) an interface (interface) that has a base
The container does not support mixed types, and derived-base conversions (Derived-base conversion) cannot be used if the derived class object is stored directly into the base class container;
Because the conversion can occur only in pointers and
Dynamic binding can only be applied to virtual functions (virtual function), through pointers (->) or references (.). Call Declares a base class pointer, binding a derived class object;
You can use "Shared_ptr P" (new Derived_class (para)); The
In multiple inheritance, if more than one base class contains a member function of the same name, when the derived class is used, ambiguity can occur, resulting in an error;
The workaround is to override the base class method in the derived class,
Virtual inheritance is primarily to prevent the base class from repeating inheritance, containing multiple identical base classes, resulting in ambiguity and inheriting with virtual base class (virtual base Class), which enables the derived object
Construction (construct) and destructor (destruct) Order of virtual inheritance (virtual inheritance)
In multiple inheritance, the constructor order is virtual inheritance in order, and again, in order, from the base class to the derived class; The
Topic: about C + +, four types of conversion keywords, the detailed, can also give the code to determine the output or determine which code is wrong.
The answers and examples are as follows:
Four kinds of keywords: const_cast, constant transfer,
Multiple inheritance, if the base class (base class) has the same member function name, the overload (overload) function call ignores public and private, selecting the best match function,
Matching degree is the same, it will cause ambiguity,
Compound methods (composition) and private inheritance can all represent the form of a new class implemented from a class, by using protected members, and by overriding the virtual function.
Choose the compound method preferentially. Reason:
1.
EBO, empty base optimization, which is the optimization of the blank base class, can make the derived class space-saving;
But if you use a composite (composition) method, because the new object is defined, the compiler fills (padding) and fills in
Prevents derived classes from redefining virtual functions, which can be implemented very simply in Java and C # (finale&sealed),
But in C + +, you need to use the method of public inheritance + composite (composition);
Note: You cannot implement
There are three ways to inherit interfaces and implementations, including:
1. Only inherit interface, pure virtual function;
2. Inherit interface and implement, allow overwrite (override), virtual function;
3. Inheritance interface and
In multiple inheritance (multiple inheritance), it is possible that multiple base classes inherit from the same base class, that is, "Diamond inheritance," which causes the topmost base class to be replicated multiple times;
You can use virtual
Through the interface class (interface Class), implements the factory function, may reuse (reuse) already has the class, overrides implements the interface.
Such as:
Interface class: IPerson; Reusable class: Personinfo; Implementation class:
Char takes up one byte, but does not satisfy a multiple of 4, the data is aligned, using bytes (byte) in multiples of 4.
Gcc:
In GCC, either a virtual function or a virtual inheritance requires that the pointer be stored in a virtual function
C + + in object-oriented programming, there are static binding and dynamic binding definition, this section is mainly about these two points of distinction.
I am analyzing the inheritance system of a class, so the object described below generally
Polymorphism, together with the data encapsulation and inheritance mentioned above, constitutes the three important mechanisms of object-oriented programming.
1. Static and dynamic joint-edit
Because of the existence of a function overload, when 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.