a). Class
b). Object
c). Instances
d). Public
e). Private
f). Super Class
g). Inheritances.
2. Write a class for each of the following specifications. In each case, include a constructor that set each member values to 0 and a member method named showdata() that can be used to display member values.
a). A class named time that has integer data members named secs, mins, and hours.
b). A class named rectangle that has integer data members named height and length.
3. Create a base class named Point consisting of x and y data members representing point coordinates. From this class, derive a class named Circle with another data member named radius. For this derived class, the x and y data members represent a circle’s centre coordinates. The member method of the Point class should consist of a constructor that set the value for x and y to 0, an area() method that return 0, and distance() method that returns the distance between two points, (x1,y1) and (x2,y2), where
Additionally, the derived class should has an overided method named area() that return’s a circle area
Area = 3.14 x radius2.
Draw UML diagram that for the class Point and class Circle.
No comments:
Post a Comment