123
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InterfacesMultiInheritance { class Program { static void Main(string[] args) { } } public interface IDrawable { void Draw(); } public interface IPrintable { void Draw(); void Print(); } // possible names conflict public interface IShape : IDrawable, IPrintable { int GetNumberOfSides(); } class Rectangle : IShape // not explicit { public void Draw() { // throw new NotImplementedException(); } public int GetNumberOfSides() { return 4; // throw new NotImplementedException(); } public void Print() { // throw new NotImplementedException(); } } class Rectangle2 : IShape // not explicit { void IPrintable.Draw() { // throw new NotImplementedException(); } void IDrawable.Draw() { // throw new NotImplementedException(); } int IShape.GetNumberOfSides() { return 4; //throw new NotImplementedException(); } void IPrintable.Print() { //throw new NotImplementedException(); } } } |