Variables, properties, fields in C #

Source: Internet
Author: User

C + + has only the concept of member variables and functions, but C # adds a lot of terminology: fields, properties, variables, methods, messages, delegates ...

  • First look at the word "variable": The term should mean a smaller subset of "variables" in C + +. Defined as a function or global definition, such as int A; used to represent a piece of memory area.
  • Field: should be a variable in the specified class. For example, define a A,int a in the class; It's strange, it's called a field.
  • attribute: Refers to a class, an interface in an encapsulation of field operations. And the difference between the fields is that there is no get,set.
  • Method: is the function.
  • Message: This is something that C + + does not have. is actually a field of the delegate?
  • Delegate: Similar to a function pointer.

Obviously, each of the above terms is not duplicated. For example, a message is neither a property nor a field, nor a method, but a message is a new type.

So there is the following saying:

The interface can only contain: methods, properties, messages, indexers. There is no field here, because the interface is an abstract description and there is no instantiation possible, but the field is memory-intensive.

Abstract classes can contain: Methods, properties, messages, indexers, fields.

Variables, properties, fields in C #

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.