Is there a difference between abstract and ordinary classes? At the time of inheritance, is it possible to inherit only one parent class?
Answer:
abstract classes do not differ from ordinary classes except that they do not implement specific code above abstract methods and properties. Still conform to the basic characteristics of the class. Therefore, in the inheritance of the abstract class also belongs to the base class, that is, only one base class can inherit.
The following code describes the basic characteristics of an abstract class: a reference type.
Abstract classHuman { Public Abstract voidThink (); Public Abstract intAge {Get;Set; } Public voidShowType (Human Human) = Console.WriteLine ($"this {human. GetType (). FullName}"); } classIam:human { Public Override intAge {Get;Set ; } Public Override voidThink () = Console.WriteLine ("The method of the parent abstract class for this implementation"); } classProgram {Staticiam iam; Static voidMain (string[] args) {iam=NewIam () {age= -}; Showage (IAM); Changeage (IAM); Showage (IAM); Console.readkey (); } Static voidShowage (iam iam) = Console.WriteLine ($"my age {iam. AGE}"); Static voidChangeage (Human iam) = iam. Age = A;}
C # abstract (4)