Record: New Keyword, new modifier, new Constraint

Source: Internet
Author: User

Summary of the usage of New in C:

 

New Keywords

1,Allocate space for objects on (HEAP;

2,Call the object constructor;

3,Return the space address of the object and place it on the stack;

 

Example:

ObjectOBJ =New Object();

Assembly:

00000027 movECX, 790f9c18h

0000002c callFfcc0e74

00000031 movESI, eax

00000033 movECX, ESI

00000035 call786a9300

10000003a movEDI, ESI

Note: I don't quite understand the compilation. I hope the experts can help me explain it!

 

 

New Modifier

1,NewThe modifier is used to declare a class or class member, indicating that the member with the same name in the base class is hidden;

2,NewModifiers can only be used to inherit classes;

 

New Constraints

NewConstraints Used for constraints in generic declarations;

PublicClass genericclass <t>WhereT:New()

 

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.