1. Create interFace
interface ISuper { int GetSuper(); }
Class can inherit multiple interfaces, or can only inherit a single abstract class.
Implemented in derived classes
public int GetSuper() { return age + 100; }
InterFace differs abstract: abstract class can not be instantiated, inherited by other classes to achieve a specific method, the method comprising the abstract class fields, the interface rules, a member can not have variable field
Create a property (two kinds) public int Age // genus {
GET { return Age + 10 ; } SET { Age = value - 10 ; // value is a member of a specific variable } }
public int ID // attribute { GET ; SET ; }
Property values may be set (default 0):
person.Age = 10;
Use the property:
Console.WriteLine(person.Age); person.Age = 10;
Too sleepy today. the above
good night