. Net Video Learning 2nd-quarter C # Object-oriented
Object-oriented Beginner
A class is a template that does not account for memory, which is the image generated by the template, which accounts for memory.
Fields field: Data methods method: Function Property: Protect field, limit the assignment of a field (wrap this part in a class, the outside world ignores how) the nature of the property is two methods get ()/set ()
External (and even intra-class methods) are assigned/read by attributes, and get ()/set () is qualified internally, and the field is always private, and the property is public.
namespace proj{ class person { private int _age; Public int Age {
get {return _age;} Set { if0) { value 0; } = value ; }}}
Write-only properties are allowed, and the compiler automatically generates fields corresponding to the attributes.
Create a keyword for a class object (instantiation) New
The keyword in the method that points to the object itself.
Non-static = instance, non-static class can have static members or non-static members
. NET Learning 2nd quarter C # Object oriented