Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

Assignment Operator Overloading

Uploaded by

Shamil Mantashli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Assignment Operator Overloading

Uploaded by

Shamil Mantashli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment.

Operator Overloading

Q1. Write a class Circle with a private member variable radius. Write function
Area that returns the area of the circle and a function Circumference that returns
the circumference of the circle.
Overload the following operators:
+ (plus) operator to add two Circle objects
> (greater than) operator to compare two Circles as to which is bigger (or smaller).
== to check whether two circles are the same or not
>> to input the circle
<< to display the circle

Q2. Write a class Triangle with a private member variables side1, side2 and side3.
Write Perimeter and Area functions that returns the perimeter and area of the
triangle.

Overload the following operators:


+ (plus) operator to add two Triangle objects
< (less than) operator to compare two Triangles
== to check whether two triangles are the same or not
>> to input the triangle
<< to display the triangle

You might also like