Home > Net >  <span> data - v - 93948064 c # class definition are superior and inheritance problem can be so
<span> data - v - 93948064 c # class definition are superior and inheritance problem can be so

Time:08-09

The //defines A class A (name of the class uncertain & # xff0c; May be called AA) & # xff0c; Does not support any changesPublic class a.{Public int Id {get; set; }Public string Name {get; set; }}//defines an interfacePublic interface IB{Public int Phone {get; set; }Public string Email {get; set; }}//defines a class B & # xff0c; This is an example of an errorPublic class B : T, IB where T: class{Public int Phone {get; set; }Public string Email {get; set; }Public List Images' {get; set; }}//how to implement the class C & # xff0c; This is an example of an errorPublic class C: B{Public string Detail {get; set; }Public DateTime AddTime {get; set; }.}//how to implement the class C & # xff0c; This is an example of an errorPublic class C : A, B{Public string Detail {get; set; }Public DateTime AddTime {get; set; }.}//the problem conditions & # xff1a; A class does not support any changes (the name of the class are not sure) & # xff0c; B classes and interfaces (including name) tinkering & # xff0c; C class doesn't implement any interface & # xff0c; Finally realizes the C belowPublic class C{Public int Id {get; set; }Public string Name {get; set; }Public int Phone {get; set; }Public string Email {get; set; }Public List Images' {get; set; }Public string Detail {get; set; }Public DateTime AddTime {get; set; }.}  

  •  Tags:  
  • Related