(1) different compiler processing methodsDefine macros are expanded during the preprocessing phase.Const constants are used during the compile run phase.(2) Different types and security checksDefine macros have no type, do not do any type checking,
Recently in the preparation of CCF, a variety of algorithms, the graph algorithm basically looked at it almost once. Today is the Dijkstra algorithm, the algorithm is a bit difficult to understand, if you do not want to find out, it is not easy to
This share is intended for partners who are interested in developing iOS, or are already working with iOS developers. If you have a high interest in iOS development, you can work with me on iOS development, learn together, and make progress together.
1, two ways of implementing code reuseCombination: I simply create an object of an existing class in the new class. Because the new class is composed of objects that already exist in the class, they are called combinations. This allows the
First, class of data member initializationThere are two possible forms of data member initialization for classes in Java.
Provide initialization values directly where class member variables are defined (this is not allowed in C + +)
To be
1. Common variables: You can assign a value in a constructor without considering the efficiency. Consider the efficiency that can be done in the initialization list of the re-constructor function. 1classCa2{3 Public:4intData5 Public:6CA ();7};89CA::
Abstract data type (abstract datatype): Uses encapsulation to hide the data structure of its implementation, allowing programmers of the type to think abstractly about what the type does, rather than specifically considering how the type is
Const Type Definition: indicates that the value of a variable or object cannot be updated. The purpose of this definition is to replace the precompiled command.
×××××× Constant must be initialized.
Role of const
A can define const constants,
A pure virtual function (pure virtual function) contains abstract base classes ). You cannot create abstract objects ).
Method: Write = 0 after the function parameter table. If the value is 1, error: Invalid pure specifier (only '= 0' is allowed)
C # Language Reference
Directory
1. Introduction 1
1.1 Hello, world 1
1.2 type 2
1.2.1 predefined Type 3
1.2.2 conversion 5
1.2.3 array type 6
1.2.4 type system consistency 7
1.3 variables and parameters 8
1.4 Automatic Memory Management 11
1.5
Const Usage Details
Object-oriented is an important feature of C ++.However, the optimizations added by C ++ on the basis of C are also very dazzling.Const can directly replace # define in C.The following points are very important, and the
Connect (2)
Users and computer humans, we have already completed the compilation. The rest is the game class. To put it bluntly, the main role of the game class is to control the game process, which is equivalentThe handle of the game machine.
Read
With the development of the computer revolution, the "insecure" programming method has gradually become one of the main reasons for the high cost of programming.Initialization and cleanup are two security issues.
Use the constructor to ensure
Use a paint brush
The attributes of a paint brush include line, line width, and color. The attributes of the paint brush can be specified in the constructor or
Setstyle (), setwidth (), setbrush (), setcapstyle (), setjoinstyle (), and other
Testing for beginners
I tested Java programming language design on my own yesterday. I don't quite remember the class initialization process. I reviewed it by the way.
A test question is also prepared. Distribute your email to the output. If the
Sometimes we want some constants to be valid only in the class. Since the macro constants defined by # define are global and cannot be achieved, it is assumed that we should use const to modify data members. The const data member does exist, but its
One of the differences between this, self, and parent in {1} PHP
Object-Oriented Programming (OOP) has become a basic skill of programmers. Using OOP for advanced PHP programming makes sense to improve PHP programming capabilities and plan the web
Google C ++ programming style guide (1): header file [this article]Google C ++ programming style guide (2): ScopeGoogleC ++ programming style guide (III): c ++ classGoogle C ++ programming style guide (4): Smart pointers and other C ++
A compilation optimization bug was found in a recent company project. Described as " On the CPU enable out-of-order execution There are bugs ". to solve this problem, a better optimization method is as follows:
Private Static
Introduction
I have never written a conceptual article, because I think it is useless to write these conceptual things in detail in books, today, I want to write a piece of whimsy. I will discuss with you the virtual base classes, virtual functions,
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.