Document directory
Friend Functions
Friend classes
Friend Functions
In principle, private and protected members of a class cannot be accessed from outside the same class in which they are declared. However, this rule does not
Inheritance and derivation:
(1) The Child class does not need to be modified to extend the features of the parent class. We call it inheritance.
(2) the process of creating a new class and adding a new levy on the basis of the original is called
Base:It is used to implement access to the public or protected members of the base class in a derived class, but is limited to constructors, instance methods, and instance attribute accessors.The specific features summarized in msdn include:(1) Call
First, talk about constI have summarized them in three aspects: 1. Const constant; 2. Const pointer; 3. Application of const in function declaration.1, const constantIts definition form isConst type_name val_name;Note the initialization problem.
Static and static keywords in C ++
Static means static. Here I want to systematically describe the role of the static keyword. Of course, it mainly describes the role of the static keyword in the development languages C and C ++. For other functions,
[Change the scale, background color, or frame rate of the output swf]
In the "Navigator" window, right-click your project, select "Properties", select "ActionScript Compiler", and enter the required command in "Additional compiler arguments ".
To
A member of the class can be: private protected public1. If a member is private, its name can only be used by the member functions and Friends of the class in which it is declared2. If a member is protected, its name can only be used by the member
Public MemberProgramThe class that implements Information Hiding can be accessed anywhere and its public members are restricted to member functions. This function defines the private member that can be used by General programs to manipulate objects
In Java, the three reserved words are used to modify the data members and member functions of the class, and the class itself. In C ++, the data members and member functions of the modifier class, and the inheritance of the class, but you don't need
Chapter 9 Object-oriented programming1. java does not support multi-inheritance (as in C ++), but it supports the "interface" concept. The interface enables java to achieve many advantages of multi-inheritance and discards the corresponding
1. Inline functionsDefinition: A member function defined within a class in which the function body of a function is placed inside the bodyFeatures: Replace the code at the call with the inline function body to solve the program's operational
C + + Controls access to the private part of the class object, and the private or protected members of the class cannot be accessed directly outside. Generally, public-class methods provide a unique access path. Sometimes this restriction is too
1. Multiple inheritance(1) Multiple inheritance has been a mechanism that has been criticized by many people in C + +, but it has greatly increased the flexibility of class hierarchies by looking at a simple example:classtask{ Public: Virtual
Experience on C + +:Never let a constructor be called a virtual function:From the simplest thought, the C + + object model is based on the virtual function table to manage the virtual function, then when the virtual function is called, it is
In some cases, it is more convenient to grant member-level access to functions that are not members of a class or to all functions in a separate class. Class-only implementations can declare their friends. A function or class cannot declare itself
C + + has added object-oriented programming on the basis of the language of C., C + + supports object-oriented programming. Classes are the core features of C + +.
Examples of classes:
Class box{public
:
int length;
int width;
int height;
When a subclass inherits a parent class, it can inherit the parent class in public, private, and protected ways, each of which differs in the following ways:
1) Public inheritance mode
All public members in the base class are public properties in
The base class performs dynamic binding by adding the keyword virtual before the declaration statement of its member function. A non-static function other than any constructor can be a virtual function. Keyword virtual can only appear within a class
C + + is mainly referred to the "deep Exploration of C + + object Model" this book to review, this book to explain the C + + object model is very thorough, before also read the "C + + Primer" and "effective C + +", The last two books are also very
In some cases, it is convenient to allow specific non-member functions to access private members of a class while still blocking general access. For example, overloaded operators, such as input or output operators, often require access to private
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.