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 #