Source: Internet
Author: User

Today is too late, I finished brushing my teeth, directly paste the notes over it, hurriedly sleep.

    • There are constants or references inside C + + classes
If there is a reference inside the member variable, it must be assigned at initialization time and can be assigned again after initializationIf there is a constant, you must also assign a value at initialization, and you cannot assign it after initialization.but we can point to this constant with a pointer, strongly to the variable, and then assign the value,the constants inside the class are also read in the way that memory is read

    • Static member functions for C + +
static member functions belong to classes and can be directly class names:: Fun, Access
    • C + + default parameters, padding from left to right

    • C + + friend function, friend class

    • C++const Object
Const objects cannot refer to non-const member functions

    • About level two pointers and references
If you want to change a pointer in a function, you can use a level two pointer, or you can use a reference to a first-level pointerint *p = #
void (int * * p1)//We pass in &p{*p = other;}orvoid (int * &p2)//We pass in P{pt = Other;}
    • The difference between Malloc,free and New,delete
new and delete automatically call constructs and destructors, and malloc and free do not call constructs and destructors only allocate memory


Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.