Exemple #1
0
        static void Main(string[] args)
        {
            Human Bobby = new Human("Bobby");                       //creating a new instance of Human Class

            Console.WriteLine(Bobby.Health);                        //the get accessor is invoked here
            Console.WriteLine("Bobby's health is " + Bobby.Health); //testing
            Console.WriteLine(Bobby.Attack());                      //invoking the attack unction
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Human A = new Human("A");
            Human B = new Human("B");

            A.Attack(B);
            Console.WriteLine(B.HumanHealth);
            //Console.WriteLine(A.HumanHealth);
        }