Cs 237 - Object Oriented Programming: PART - A (10 X 2 20 Marks)
Cs 237 - Object Oriented Programming: PART - A (10 X 2 20 Marks)
PART - B (5 x 16 = 80 Marks)
11. Explain in detail the following principles of object oriented programming (i) (ii) (iii) Data encapsulation and data hiding Inheritance and polymorphism Generic programming.
12.a) Create a class complex to represent complex number with overloaded addition and multiplication operators. Use them in a main program. (OR) 12.b) Define a class string with appropriate constructors, destructor and overloaded +, =, and = = operators use them in a main driver program. 13.a) What are the different forms of inheritance? Give example for them. (OR) 13.b) Create an abstract base class shape with two members base and height, a member function for initialization and a pure virtual function to compute area ( ). Derive two specific classes Triangle and Rectangle which override the function area ( ). Use these classes in a main function and display the area of a triangle and a rectangle. 14.a) Write a C++ program containing a possible exception. Use a try block to throw it and a catch block to handle it properly. (OR) 14.b) Create a data class using Java with the following capabilities. Out the date in multiple format such as (i) dd - mm - yy
(ii)
15.a) Write a Java class point to represent a two dimensional point (x, y). Extend it to a class circle with its centre as the point and an additional radius member and extend further to a class cylinder with additional height member. (OR) 15.b) Explain the concept of nested classes in Java with a suitable example.