C # downgrade with C + + SDK coding common sense

Source: Internet
Author: User
A set of coding specifications that invoke C # 's auto-encapsulated C # SDK through C # will discover the importance of object-oriented thinking. The C + + SDK can be converted to the C # SDK using the Automatic encapsulation tool. However, the following rules are required: 1. If a C # object needs to be judged, there are three cases (take bmppen as an example): Determine if the C # object itself is equal to bool isequal=object.    Equals (BP1,BP2); Determines if C # holds a pointer to C + + objects equal to bool Isequal= (BP1. Nativeobject==bp2.    NativeObject); Determines whether the values of C + + objects held by C # objects are equal to bool isequal= (BP1==BP2); 2. About derivation: C # can be derived from C + + auto-encapsulated C # classes C # can override the virtual methods of C + + to allow C # to add non-public methods, non-public properties when C # increases public methods, public properties, you must use the combination of way 3. Life cycle: Who applies, who releases (c + + auto-encapsulated C # SDK objects need to call Dispose () of this object ) 4. Smart pointer: The life cycle of a smart pointer is the same as the object life cycle, and the smart pointer object is just a special object that manages the memory of another object it aggregates by reference counting. It is important to note that when a smart pointer object is destroyed, it simply decrements the reference count, does not necessarily destroy the aggregate object, and only the reference count equals 0 o'clock, the aggregate object is destroyed. After C # calls the smart pointer object, it is important to explicitly release the smart pointer object, otherwise the reference count of the smart pointer object does not decrement, whereas in a C + + program, the smart pointer object is released immediately.

C # downgrade with C + + SDK coding common sense

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.