File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Practical Lab Assignment - Binary Operator Overloading
2
+
3
+ ### Program 1
4
+ ```
5
+ Create a class Rectangle.
6
+ Private members of class Rectangle: Length, breadth.
7
+ Create Member function:
8
+ Public:
9
+ double getArea()
10
+ void setLength(double)
11
+ void setBreadth(double)
12
+ ```
13
+ Declare overloading function use ** (+)** operator to add two Rectangle objects.
14
+ In the ` main() ` function set rectangle length, breadth with member functions and use area function to print area of each rectangle.
15
+ Then declare a third object use overloading function to get area of third object.
16
+
17
+ ### Program 2
18
+ ```
19
+ Create a class Distance.
20
+ Private members of class Distance: Kilometer, meter.
21
+ Create default constructor and parameter constructor.
22
+ Create Member function:
23
+ void showDistance()
24
+ ```
25
+ Declare overloading function use ** (==)** operator to compare two distances.
26
+ In the ` main() ` function set Distance kilometer, meter and use show distance to print of each distance.
27
+ Then use overloading function to get difference of two distances.
You can’t perform that action at this time.
0 commit comments