fork download
  1. using System;
  2.  
  3. namespace Testprogramm
  4. {
  5. public class TestKlasse
  6. {
  7. public struct Teststruct
  8. {
  9. public bool testbit1=false;
  10. public bool testbit2=false;
  11. };
  12.  
  13. Teststruct TS = new Teststruct();
  14.  
  15. public Teststruct AufrufStruct()
  16. {
  17. TS.testbit1= true;
  18. TS.testbit2= true;
  19. return TS;
  20. }
  21. }
  22.  
  23. static class Program: TestKlasse
  24. {
  25. /// <summary>
  26. /// Der Haupteinstiegspunkt für die Anwendung.
  27. /// </summary>
  28. [STAThread]
  29. static void Main()
  30. {
  31. TestKlasse TK = new TestKlasse();
  32. TK.AufrufStruct();
  33.  
  34. Teststruct TS;
  35.  
  36. Console.WriteLine("Das Testbit1 hat den Wert", TS.testbit1);
  37. }
  38. }}
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(23,18): error CS0713: Static class `Testprogramm.Program' cannot derive from type `Testprogramm.TestKlasse'. Static classes must derive from object
prog.cs(9,20): error CS0573: 'Testprogramm.TestKlasse.Teststruct': Structs cannot have instance property or field initializers
prog.cs(10,20): error CS0573: 'Testprogramm.TestKlasse.Teststruct': Structs cannot have instance property or field initializers
Compilation failed: 3 error(s), 0 warnings
stdout
Standard output is empty