static void Main(string[] args)
        {
            Rectangle rectangle = new Rectangle(10, 15);
            var       area      = rectangle.GetArea();

            Square square  = new Square(96);
            var    littleR = square.GetLittleR();

            Human human = new Human();

            human.Say();

            Student student = new Student(18, 21);

            student.Say();
            student.Learn();

            RomanoStudent romanoStudent = new RomanoStudent(5, 19);

            romanoStudent.Say();
            romanoStudent.Learn();
            romanoStudent.Talk();
            romanoStudent.GetGender();

            Console.WriteLine(student.Age);
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            // The Principal class will ouput
            // 'Monitor' since the variable
            // 'g' is the simply declared as a
            // new Princpal() class.
            Principal g = new Principal();

            g.Monitor();

            // d will return 'Monitor' as it
            // is a child class of the Principal
            // so it will inherit the base
            // function. At the same time, it
            // can call its own function when
            // used in d.Teach().
            Teacher d = new Teacher();

            d.Monitor();
            d.Teach();

            // The student class is another
            // child class of Principal. It
            // contains its own unique function
            // printing out 'Learn' while
            // retaining Principal's 'Monitor'
            // and thus will be able to call it
            // when used in dot notation.
            Student s = new Student();

            s.Monitor();
            s.Learn();
            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            Teacher d = new Teacher();

            d.Teach();
            Student s = new Student();

            s.Learn();
            s.Teach();
            Console.ReadKey();
        }
Example #4
0
        static void Main(string[] args)
        {
            Teacher d = new Teacher();

            d.Teach();
            /*herencia Ășnica: una clase base y una derivada*/

            Student s = new Student();

            s.Learn();
            d.Teach();
            Console.ReadKey();
        }
Example #5
0
        static void Main(string[] args)
        {
            // information is stored here on the heap
            Teacher d = new Teacher();

            d.Teach();

            // a derived class is created to inherit from base
            Student s = new Student();

            s.Learn();
            s.Teach();
            Console.Read();
        }
Example #6
0
        static void Main(string[] args)
        {
            Principal g = new Principal();

            g.Monitor();
            Teacher d = new Teacher();

            d.Monitor();
            d.Teach();
            Student s = new Student();

            s.Monitor();
            s.Learn();
            Console.ReadKey();
        }
Example #7
0
        static void Main(string[] args)
        {
            Teacher d = new Teacher();

            d.Teach();
            Console.WriteLine(d.schoolPerson);
            Student s = new Student();

            s.Learn();
            s.Teach();
            Console.WriteLine(s.schoolPerson);
            Console.ReadKey();

            //Since Student s inherits from teacher it also has the ability to call the function Teach
        }
Example #8
0
 public void Teach(Student student)
 {
     student.Learn(Specialty);
 }
Example #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Some Students and Instructors");

            Student betty = new Student()
            {
                Age         = 10,
                Name        = "Betty",
                SlackHandle = "@youbettya",
                Grade       = "5th",
            };

            betty.Learn("soap carving");
            betty.AskQuestion();
            betty.PrintDescription();
            betty.PrintStudentDescription();

            Student roy = new Student()
            {
                Name        = "Roy",
                Age         = 12,
                Grade       = "6th",
                SlackHandle = "@royrules",
            };
            Student jane = new Student()
            {
                Name        = "Jane",
                Age         = 13,
                Grade       = "7th",
                SlackHandle = "@janetastic"
            };

            Instructor rita = new Instructor()
            {
                Name        = "Rita",
                Age         = 39,
                Specialty   = "Global Thermo-nuclear War Prevention",
                Email       = "*****@*****.**",
                SlackHandle = "@rita",
            };
            Instructor leon = new Instructor()
            {
                Name        = "Leon",
                Age         = 45,
                Specialty   = "Bird watching",
                Email       = "*****@*****.**",
                SlackHandle = "@leon",
            };
            Instructor pat = new Instructor()
            {
                Name        = "Pat",
                Age         = 50,
                Specialty   = "Tuning Ukuleles",
                Email       = "*****@*****.**",
                SlackHandle = "@pat",
            };

            leon.Teach(betty);
            pat.Teach(betty);
            rita.Teach(betty);
            string judgement = rita.JudgeStudent(betty);

            Console.WriteLine(judgement);

            leon.PrintDescription();

            Person someGeneridPerson = new Person()
            {
                Name        = "Rando",
                Age         = 91,
                SlackHandle = "@notonslack",
            };

            someGeneridPerson.PrintDescription();

            ShowDetails(someGeneridPerson);
            ShowDetails(betty);
            ShowDetails(leon);

            leon.Learn("ruby");
            leon.Knowledge = new List <string>()
            {
                "javascript", "tennis"
            };

            // a student's knowledge doesn't have a set
            //betty.Knowledge = new List<string>() { "Mountain Climbing"};

            TeachSomething(leon, "fishing");
            TeachSomething(betty, "Cleaning my deck");

            // Person does not implement ILearner
            //TeachSomething(someGeneridPerson, "c#");

            ILearner learner = new Student()
            {
                Name        = "Learner",
                Age         = 22,
                SlackHandle = "@learner",
                Grade       = "some grade"
            };

            List <ILearner> learners = new List <ILearner>()
            {
                leon, betty, learner, pat
            };
        }