The meta-function of a class is defined outside the class scope, but has the permission to the private member of the category class. A function or the entire class can be declared as a friend of another class.
To declare a function as a
// Directed acyclic graph Topology Sorting. cpp: Defines the entry point for the console application.
//
# Include "stdafx. h"
# Include
# Deprecision MAX 100
Using namespace std;
Enum Color {white, gray, black };
Struct edgeNode
{
Int no; // The
// Search for the breadth of an undirected graph (stored in an adjacent table). cpp: Defines the entry point for the console application.
//
# Include "stdafx. h"
# Include
# Deprecision MAX 100
# Define MAXQ 50
Using namespace std;
Struct
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:
1. As a standard library type, there are four basic constructor types in string. As follows:
String s; // default constructor; s is an empty string
String s (s1); // use s1 to initialize s
String s ("My Blog http://www.bkjia.com"); // initializes
I always thought that c ++ was very serious at the beginning, but I still don't understand how to use namespace. I am not clear about what I have mentioned in the book. Now I understand the C ++ Programming Language. O (Clerk □clerk)
1. There are two points of view for the const modified member functions: logic constness and bitwise constness.
Bitwise constness's point of view is: "It does not change any bit of the object". In this way, the compiler only needs to assign
There are still some misunderstandings about value passing, pointer passing, and reference passing. I think it is necessary to explain it here ~
The following is an example to describe in detail.
Value transfer:
The form parameter is a copy of the
15.4.3 replication control and inheritanceThe derived class can also use the composite copy control member. The merging operation copies, assigns values, or revokes the base class part of the object together with the members of the derived part,
16.5 a generic handle class
16.5.1 define the handle class
# Ifndef HANDLE_H# Define HANDLE_H # Include "stdafx. h"# Include Using namespace std; Template Class Handle {Public:Handle (T * p = 0): ptr (p), use (new size_t (1 )){}T & operator *();T *
16.6 special Template
16.6.1 special function Template
Template specialization is a definition that specifies the actual type or actual value of one or more template parameters. The special form is as follows:
Keyword template followed by an empty
17.1.2 stack Expansion
If the function that throws an exception is called in the try block, check the catch clause related to the try. If a matching catch is found, an exception is handled. If no matching catch is found, the call function also exits
17.1.7 exception levels
The unique operation defined by the exception type is a virtual member named what. This function returns the const char * object, which generally returns information used to construct the exception object at the throwing
# Include Using namespace std; Class X{Public:Static int;Const static int c = 10;Private:Static int B;Public:Int get (){Return B;}}; // Static variables can be defined and assigned externally, even if they are private// Int X: B = 10; Int main (){X
Problem introduction:During the internship, a default error was found, which is also char * c = "abc" and char c [] = "abc". The former changes the default error. The program crashes, and the latter is completely correct.Program Demonstration:Test
PrefaceWhen I recently looked at the auto_ptr source code, I found many exceptions. In fact, there were a lot of confusions about exception handling in the past. It was just because it was rarely used in the code at ordinary times, so I never
Clause 01: regard C ++ as a Language Federation
View C ++ as a federation of different ages.
Today, C ++ is a process form (procedural), object-oriented (oriented), function form (functional), and generic form (generic) metaprogramming language. C ++
I wrote a diary at night and found that dozens of articles have not been written.Because the diaries are arranged by the number of daysWe need to manually add the days, weather, and weekly articlesCompiled a small programBy the way, let's take a
Process DataI. Classification
Basic Type + Composite TypeBasic types include integer and floating point
Composite types include: structure (struct)
Integer ClassificationInteger: char short int long and unsignedFloat: float double long doubleBoolean:
Liskov Substitution Principle (LSP)Definition:Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.All references to the base class must be transparent to use its subclass
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service