static void Main(string[] args) { Cat 하양이 = new Cat("하양이", "하얀색"); 하양이.Meow(3); Console.WriteLine($"고양이 이름은 {하양이.name}이고 색깔은 {하양이.color}이다."); }
static void Main(string[] args) { // these are the fields Cat cat01 = new Cat(); cat01.name = "Kitty"; cat01.age = 3; cat01.Meow(); }
static void Main(string[] args) { /*Animal nurr = new Animal(); * nurr.name = "Nurr"; * nurr.age = 15; * nurr.levelOfHappiness = 0.1; * nurr.PrintAnimalBaseInfo();*/ Dog scooby = new Dog(); scooby.name = "ScoobyDoo"; scooby.age = 1; scooby.levelOfHappiness = 0.1; scooby.spotCount = 5; scooby.PrintAnimalBaseInfo(); Cat miisu = new Cat(); miisu.name = "Miisu"; miisu.age = 2; miisu.levelOfHappiness = 0.5; miisu.levelOfCuteness = 1; //Cat Meows for (int i = 0; i < 10; i++) { miisu.Meow(); } miisu.ShowLevelOfCuteness(); //Dog Barks for (int i = 0; i < 20; i++) { scooby.Bark(); } miisu.HearBarks(scooby.numbersOfBarks); if (miisu.levelOfHappiness < 0) { Console.WriteLine($"{miisu.name} died of stress."); miisu = null; } scooby.ShowNumberOfDogSpots(); scooby.ShowLevelOfHappiness(); Console.ReadLine(); }