Fourth, multi-level inheritance some object-oriented language allows a class to inherit a class from multiple base classes, while others only allow inheritance from one class, but can be inherited from several interfaces or pure abstract classes.
Only C supports multi-level inheritance, many programmers have a mistake. Multi-level inheritance often causes confusion between the categories of inheritance, inheriting the way, there is often no uniqueness, so the inheritance of C # Classification can only be one, that is, the subclass can only be derived from a parent class, and sometimes you must Inheriting the characteristics of multiple classes, in order to achieve multiple inheritance must use interface technology, the following is a multi-inheritance of the interface:
Using system; // Defines the interface interface IPOINT {INT X {Get; set;}} interface {get; set;}} interface; set;}}} interface; set;}} // inherited in Point; Two parent class interfaces, and use two parental interface methods Class Point: iPoint: iPoint: iPoint2 {// Defines the private member variables of two categories of internal access Private INT PX; Private Int Py; Public Point (int X, INT Y) {px = x; py = y;} // defined attribute, iPoint interface method implements public int x {get {return px;} set {px = value;}} // iPoint1 interface method implementation public int y {GET {RETURN PY;} set {py = value;}}} class test}} class test (iPoint P) {Console.WriteLine ("x = {0}, y = {1}", PX, PY) Public static void main () {POINT P = New Point (15, 30); console.write ("the new point is:"); OUTPUT (P); string myname = console.readline (); console.write ("My Name IS {0}", MyName);}}