Chapter 1 Definition class

Source: Internet
Author: User

9.1 class definition in C #

C # Use the class keyword to define the class [Default internal]

Class myclass {// class members}

By default, the class is declared as internal, that is, only the code in the current project can access it. You can use the internal access modifier keyword to display the specified, as shown below (but this is not necessary)

Internal class myclass {// class members}

In addition, you can specify that the class is public and should be accessible by code from other projects. To do this, use the public keyword.

Public class myclass {// class members .}

Note: Classes declared in this way cannot be private or protected. You can use the modifiers of these classes to declare class members. For details, see Chapter 10th.

 

In addition to the two access modifiers, you can also specify that the class is abstract (not instantiated, can only inherit, can have abstract members) or sealed (not inherited ).

Chapter 1 Definition class

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.