static void Main(string[] args) { MyClass newclass = new MyClass(); newclass.SetFields("blabla", 456); string str = newclass.GetFields(); Console.WriteLine($"str: {str}"); // 0 und nicht NULL wegen myField2 = int MyClassWProps myclasswprops = new DLibrary.MyClassWProps("Max", "Mustermann"); Console.WriteLine($"Mein Name ist: {myclasswprops.Firstname} {myclasswprops.Lastname}"); //======================================== Console.WriteLine("\n ### INHERITANCE ###"); Random myRandom = new Random(); Console.WriteLine($"Rückgabe von myRandom.Next(): {myRandom.Next(2, 3)}"); MyClassWInheritance myClassWInheritance = new MyClassWInheritance(); Console.WriteLine($"Rückgabe von myClassWInheritance.NextInclusive(): {myClassWInheritance.MaxInclusive(2, 3)}"); //======================================== Console.WriteLine("\n ### INHERITANCE & CONSTRUCTOR : BASE ###"); MyClassWInhNCtor myClassWInhNCtor = new MyClassWInhNCtor("Kevin-Pascal", "Müller", "Köln, Musterstraße 0"); Console.WriteLine($"Inhalt der myClassWInhNCtor: {myClassWInhNCtor.BeschreibeMich()}"); Console.ReadKey(); }
static void Main(string[] args) { MyClass myclass = new MyClass(); myclass.SetFields("blabla", 43); string str = myclass.GetFields(); Console.WriteLine($"str: {str}"); // 0 MyClassWProps myclasswprops = new DLibrary.MyClassWProps("Jan", "Ehmann"); Console.WriteLine($"{myclasswprops.Firstname} {myclasswprops.Lastname}"); //======================================== Console.WriteLine("\n ### INHERITANCE ###"); Random myRandom = new Random(); Console.WriteLine($"Rückgabe von myRandom.Next( 2, 3): {myRandom.Next(2, 3)}"); MyClassWInheritance myClassWInheritance = new MyClassWInheritance(); Console.WriteLine($"Rückgabe von myClassWInheritance.NextMaxInclusive( 2, 3): {myClassWInheritance.NextMaxInclusive(2, 3)}"); MyClWInhNCtor myClWInhNCtor = new MyClWInhNCtor("Kevin-Pascal", "Müller", "Dingenskirchen, Dingenstraße 0"); Console.WriteLine($"Die Person heißt {myClWInhNCtor.Firstname} {myClWInhNCtor.Lastname} und wohnt in {myClWInhNCtor.Wohnort}"); Console.WriteLine($"myClWInhNCtor.BeschreibeMich(): {myClWInhNCtor.BeschreibeMich()}"); Console.ReadKey(); }