Good Programming Practice 3.2

Source: Internet
Author: User
Define our first class (these lines collectively are called a class definition ).
C # programs consist of pieces called classes, which are logical groupings of members (e.g .,
Methods) that simplify program organization. These methods (which are like functions in
Procedural programming versions) perform tasks and return information when the tasks
Are completed. a c # program consists of classes and methods created by the programmer
And of preexisting classes found in the framework class library. Throughout this book, we
Will teach the reader how to use both techniques in their programs. Every program in C #
Consists of at least one class definition that the programmer defines. These classes are
Known as programmer-defined classes. In chapter 8, Object-based programming, we discuss
Programs that contain multiple programmer-defined classes. The class keyword
Begins a class definition in C # And is followed immediately by the class name (welcome1,
In this example). keywords (or reserved words) are reserved for use by C # And always consist
Of lowercase letters. (a complete table of C # keywords is presented in the next chapter .)
By convention, each word in a class name begins with an uppercase first letter and has
Uppercase letter for each word in the class name (e.g., sampleclassname). The name
Of the class is known as an identifier, which is a series of characters consisting of letters,
Digits, underscores (_) and "AT" symbols (@). Identifiers cannot begin with a digit and
Cannot contain spaces. Examples of valid identifiers are welcome1, _ value,
M_inputfield1 and button7. the name 7 button is not a valid identifier because it
Begins with a digit, and the name input field is not a valid identifier because it contains
A space. The "at" character (@) can be used only as the first character in an identifier. C # Is
Case Sensitive-uppercase and lowercase letters are considered different letters, so A1 and
A1 are different identifiers.

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.