Questions and Answers of OOP's Concept
1. Write a program to create ‘MyClass’ with Random data member, Static Constructor, GetValue() methodto return Random number. Create instances for MyClass and try to retrievevalues. Display the results on Console application.
2. Write a program to create ‘Employee’ classwith id, name non-static members and employeeCounter as Static data member.Accept id, name values from user (using Console.ReadLine() method) and assignthem to Employee data members. Count how many objects created for Employeeclass, display the content using Console application.
1. 3. Write a program to create ‘Square’ classwith Area() method to calculate the Area of a Square. Create ‘Cube’ Class asderived class to Square class and override (using virtual, override keywords)the Area() method to calculate the Area of a Cube. Display the Area result onConsole application.
1. 4 Write a program to create ‘Employee’ class(Base) with public Show() method. Create ‘SalaryEmployee’ class (Derived) withDisplay() method which should internally call the Show() method of Employeeclass. Show the methods’ content using class objects in Console application.
1. 5. Write a program to create ‘ConstOverLoad’class with a Constructor which takes a, b Integer values as arguments andassign as Height, Width values for Rectangle. Overload the Constructor methodwith size value as argument and assign as Height & Width value for Square.Show the results on Console application.
No comments:
Post a Comment