fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public class A
  6. {
  7. public string P1{get;set;}
  8. public string P2{get;set;}
  9. public string P3{get;set;}
  10. public string P4{get;set;}
  11. public string P5{get;set;}
  12. public string P6{get;set;}
  13. }
  14.  
  15. public class B : A
  16. {
  17. public string P7{get;set;}
  18. }
  19.  
  20. public static void Main()
  21. {
  22. A varA = new A();
  23. //Sets all the A's properties;
  24.  
  25. //Now,
  26. B varB = //B instance with the properties values of varA without doing :
  27. //varB.P1 = varA.P1;
  28. //...
  29. }
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(8,17): error CS0102: The type `Test.A' already contains a definition for `P1'
prog.cs(7,17): (Location of the symbol related to previous error)
prog.cs(9,17): error CS0102: The type `Test.A' already contains a definition for `P1'
prog.cs(7,17): (Location of the symbol related to previous error)
prog.cs(10,17): error CS0102: The type `Test.A' already contains a definition for `P1'
prog.cs(7,17): (Location of the symbol related to previous error)
prog.cs(11,17): error CS0102: The type `Test.A' already contains a definition for `P1'
prog.cs(7,17): (Location of the symbol related to previous error)
prog.cs(12,17): error CS0102: The type `Test.A' already contains a definition for `P1'
prog.cs(7,17): (Location of the symbol related to previous error)
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty