. Net base and this

Source: Internet
Author: User

 

    • Base

The base keyword is used to access the base class members from the derived class.

      • common use
        • call methods that have been overwritten by other methods on the base class.
        • specify the base class constructor to call when creating a derived class instance.
      • remarks

Base Class access can only be performed in constructors, instance methods, or instance attribute accessors. It is incorrect to use the base keyword in a static method.

    • This

This keyword references the current instance of the class.

      • common use
        • restrict hidden members with similar names
        • passing objects as parameters to other methods
        • declare the indexer
      • remarks

because static member functions exist at the class level and are not part of an object, therefore, there is no this pointer. It is wrong to reference this in a static method.

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.