I. Memorandum Mode
Definition: capture the internal state of an object without compromising encapsulation, and save the state outside the object. In this way, the object can be restored to the previously saved state.
Structure:
Scope of use:
The
1.an iterator (iterator) is a data type that examines the elements within a container and iterates through the elements. (1) Each container type defines its own iterator type, such as vector:Vector::iterator ITER; This statement defines a variable
Analysis of C ++: youyuan classI. Reasons for the article
In the previous article, I wrote a friend meta function. This time I wrote a companion article to continue to explore the friend Meta class.Ii. Definition
All member functions of the
Friend: Friend class of friends function.Friend function: does not belong to any class, just declare in the class (can be placed in private or public, no difference), tell the class, this function is your friend, of course, friends are not white:
"Item 1-member function, friend function and general function are different" references(1) Read the following procedure and experience the instructions in the gaze (to execute the program, please find the course homepage and copy the Code)//Example:
C + + language Learning (vii)-friend one, friend Introduction 1, Friend introductionThe design mechanism of object-oriented programming implements the hiding and encapsulation of data, the member variables of class are generally defined as private
1. an iterator (iterator) is a data type that examines the elements within a container and iterates through the elements. (1) Each container type defines its own iterator type, such as vector:Vector::iterator ITER; This statement defines a variable
At first, I thought it was too dull. In the eighth chapter, the author's analysis of the object-oriented problem, I follow the design and development of the book, understand some of the concepts previously just seen in the book.Make some notes for
A.h fileClass A{Public:void MethodA ();...};
B.h fileClass B{Public:void MethodB ();...}
It is now in Class A to invoke the method in Class B, and in Class B there is a method to invoke in Class A.
Failed methods tested:
Method 1:
A.h file#include
forwarding Please indicate the source: http://blog.csdn.net/qq_28055429/article/details/51507170
One, single responsibility principle: in the case of a class, there should be only one reason for its change (that is, the implementation class should
The Dimitri Rule (LoD) is also known as the minimum knowledge principle (least knowledge PRINCIPLE,LKP), which, although the name is different, describes the same rule: an object should have a minimal understanding of other objects. In layman's
1#include 2#include string>3#include 4#include 5#include"thread_pool.h"6 7 8 using namespacestd;9templateclassT>Ten class Base{ OneFriend T;///Friend class A Private: - Base(){} -~Base(){} the }; - - classDerived: Public Virtual Base - { +
This example shows three elements of object-oriented programming: data abstraction, inheritance, and dynamic binding.
Problem: The Expression Tree of an arithmetic expression, such as (-5) * (3 + 4), corresponds to the following expression tree:
C Friend-FriendFriend is used to break the limit of protected or private protection, the first thing to do is to be declared in the class of the visitor is a friend function or friend class. The code is as follows
#include >
using
Dimitri LawOne: The Dimitri rule defines:----> Dimitri (Law of Demeter,lod) is also known as the least-knowledge principle (Least knowledgePRINCIPLE,LKP),----> An object should have a minimal understanding of other objects. In layman's words, a
static meansThere are two types of representations in C + +, static member variables and static member functionsA static member in a class belongs to the current class only and does not belong to an object. A static member of a class has only one
Before I mentioned the concept of combinatorial classes, I'll introduce two classes, friends, and inner classes today.A combination class is an object in a class that has another class, such as declaring a class Penson, a member variable having a
This article from http://blog.csdn.net/canco/
3. Method for deleting elements in the list containerFor list containers, since list itself has member functions of remove and remove_if, it is better to give priority to the list algorithm. For the
There are three types of membership declarations that can appear in the class template:1. Non-template friends or friends Functions
The Foo () member functions bar () and foobar classes are the friends of all instances of the queueitem class
According to section 16.4 of the third edition of C ++ primer, the C ++ class template can be divided into the following situations:1. Non-template friends or friends functions. Here is an example:Class Foo {Void bar ();};Template Class queueitem
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.