From: http://blog.csdn.net/gztoby/archive/2004/09/21/112041.aspx
I learned a lot after reading it.
Introduction
Young people who have never sent text messages must belong to a protected rare animal. Today's well-developed text messages have become an important means for people to communicate, which also contains huge market and economic benefits, the talents who master text message technology are also sought after by major companies and are currently a shining star in the workplace. This a
What is the basic object-oriented principle?Design principles are basic tools. applying these rules can enable yourCodeIt is more flexible, easier to maintain, and easier to expand.
C # basic object-oriented principles
1. Compile APIs instead of implementing [code to an interface rather than to an implementation.]Ii. Prioritize combination rather than inherit
Abstract
To:
Constructor and destructor are two seemingly simple functions in a class.
But there will always be some unexpected running errors in the actual application process. This article will be a more systematic introduction
The principles of constructor and destructor C #
And several things that need to be paid attention to during use.
Keywords:Constructor; destructor; garbage collect
This article from http://www.cnblogs.com/sufei/archive/2010/03/10/1682847.html
Latest skin
Http://www.cnblogs.com/sufei/archive/2010/01/14/1648035.html
Description
Many of my friends suggested that I write down the principle. In fact, I would like to write it, but I have never had time. Today I have time to open a question !!! SentenceFamous sayingWell said, work hard, but do not bury yourself in the dark,
It takes thousands of miles to complete. Character de
likely to make major changes to the program in the future, I don't have to turn every public field into a property. For example, when designing some lightweight struct for interoperability, it is no good to directly use the public field. Therefore, it seems that the use of "always use properties instead of accessible data members" in this entry is too tough.
In fact, the discussion here also shows what you need to pay attention to when reading Objective C
Atitit. Principles for implementing inheritance and methods java JavaScript. NET C # php ...1. Implementation of inheritance issues 12. How do I copy a base class method? Using the prototype prototype, by impersonating object 13.2. How do properties inherit? 24. Comparison of several inheritance methods 25. Common Apply, call method 36. Reference 31. Implementation of inheritance issuesto implement inherit
stream looks for 0 and 1, for example, if you enter the following:10121Input stream will be read into 101,21 will be left.For bytes and words, the bits in the bitset are numbered from right to left (from the least significant bit to the most significant bit). Thus, the value of the 7th bit is 27;
7:
6:
5:
4:
3:
2:
1:
0:
1
0
1
0
0
1
1
1
For Bitset, the numbering sequence is not just a
. Also, there is no subclass of struct types, so there is no polymorphism in some way, and there is no cutting (slicing) effect that may occur when C + + objects are passed. However, the cost of a value copy is still not small. Especially in the case of a large value type, the problem is more serious. In fact, in the design guidelines for Class Library developers documentation for the. NET Framework, there is a principle (and some other concurrent
software organization has only the minimum knowledge of other units and is limited to software units closely related to the same unit.
Dimit rules and Design PatternsFacade mode and mediator Mode
Make people ignorantThe third chapter of Lao Tzu said: "It is based on the governance of saints, and lacks its heart, its belly, and its ambition. It often makes the people ignorant and heartless. The "Ignorance" of the "ruling" object is in the "Ignorance" state, which can reduce the cost of "ruling.T
The main purpose of my article is to introduce the principles of high quality design for a subset of classes and interfaces. These guidelines should not only ensure that the design and implementation of the class or interface itself has high-quality code, but more importantly in the industrial field should be as much as possible to update and maintain the code does not affect the customer's activities, mainly to maintain the binary code compatibility
C # Object-oriented principles
One, interface-oriented rather than implementation [Code to a interface rather than to a implementation.]
Second, the use of a combination of priority rather than inheritance [favor composition over inheritance.]
Third, srp:the single responsibility principle sole responsibility
Each object in the system should have only one separate responsibility, and all objects are conce
base class (which later discusses how to determine the inheritance relationship), so the conversion is also possible.Compile the above source with clang, generate the LLVM assembler as follows (Simplified):@_zti1a= LINKONCE_ODR constant {i8*, i8*} {...} @_zti1b= LINKONCE_ODR constant {i8*, i8*} {...} @_zti1c= LINKONCE_ODR constant {i8*, i8*, i8*} {..., i8* bitcast ({i8*, i8*}* @_zti1a to i8*)}@_zti1d= Linkonce_odr C onstant {i8*, i8*, I32, I32, i8*,
= LINKONCE_ODR constant {i8*, i8*} {...} @_zti1c @_zti1a to i8*)}@_zti1d= LINKONCE_ODR constant {i8*, i8*, I32, I32, i8*, i64, i8*, i64} {...,
@_ZTI1B to i8*), i64 2,
@_zti1c to i8*), I64 2050 }
As you can see, the contents of the Rtti object also include the base class's Rtti object pointers, which are tree-like structures:Therefore, the inheritance relationship can be judged by this tree structure, with the inheritance relationship, and then recursively find t
The basic grammar and principles of C language are initially:/* ******************************************* *Data typeDescription Data sizeChar 1Short 2int 4Float 4Double 8Constructed typeStorage typeThe location that is stored in memory(Heap, stack (auto), static region, code snippet)FunctionOperation of the code (what to Do)+-*/% | | is an operatorControl statementsSelect or cycleFunction* **************
function is a function that determines the call at compile time. In efficiency, the efficiency of virtual function is much lower.Illustration 2:For efficiency reasons, it is not necessary to declare all member functions as virtual functions.Demo#include Description 3:c++ compiler, execute howtoprint function, do not need to distinguish between child class object or parent class objectThe following proves the existence of the vptr pointer.Demo#include
Summary of the implementation principles of polymorphism by the c ++ Compiler (1)
Question: Define an empty type without any member variables or member functions. What is the result of sizeof operation on this type?
The result is 1. Because an empty instance does not contain any information, the result is 0 after sizeof calculation, but when declaring an instance of any type, the memory must occupy a certa
applications, using pointer arithmetic is more convenient.The name of the array represents all the elements of the array. Example: Char ch[100]; The size of CH sizeof (CH) is 100. However, the name of the array can be transformed (degraded) into pointers. For example: char * p = ch;PalindromeUse a string to implement a palindrome. Track the progress of character comparisons using the string type of the standard library and an index of type int:BOOL Is_palindrome (const string s) {int first = 0;
to change.Translate into natural language description:
If the coin event is received in the locked state, it is migrated to the unlocked state and the unlock function is called.
If the pass event is received in the unlocked state, it is migrated to the locked state and the lock function is called.
If the coin event is received in the unlocked state, it remains in the unlocked state and calls the Thankyou function.
If the pass event is received in the locked state, it remain
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.