static void Main(string[] args) { /* What I think this means is the following: * 1. Class * 2. Variable * 3. Declaring the Class is also a method? * * This allows us to use methods in classes that aren't apart of this file? * Pressing F12 in VS2015Community allows us to access the method */ Person person = new CSharpTutorial.Person(); Animal species = new CSharpTutorial.Animal(); // Human Names Console.WriteLine(person.NameAsk()); Console.WriteLine("Your name is supposed to be " + person.NameFull()); // Animal Names Console.WriteLine(species.NameAsk()); Console.WriteLine("Your name is supposed to be " + species.NameFull()); }
private static void ClassesExample() { Animal spot = new CSharpTutorial.Animal(15, 10, "Spot", "Woof"); Console.WriteLine("{0} says {1}", spot.name, spot.sound); Console.WriteLine("Number of animals: " + Animal.getNumOfAnimals()); Console.WriteLine(spot.toString()); Console.WriteLine(spot.getSums(1.2, 2.3)); Console.WriteLine(spot.getSums(num2: 1, num1: 2)); Animal grover = new Animal { name = "Grover", height = 16, weigth = 18, sound = "Grrr" }; Dog spike = new Dog(); Console.WriteLine(spike.toString()); spike = new CSharpTutorial.Dog(15, 20, "spike", "Grrr", "chimken"); Console.WriteLine(spike.toString()); }