Computer Science, asked by shrinivasgadiwan, 5 hours ago

write a c++ program using operator overloading >>: to accept the time.​

Answers

Answered by hs933009
0

Explanation:

Overloading Arithmetic Operator in C++

Arithmetic operator are most commonly used operator in C++. Almost all arithmetic operator can be overloaded to perform arithmetic operation on user-defined data type. In the below example we have overridden the + operator, to add to Time(hh:mm:ss) objects.

Example: overloading + Operator to add two Time class object

#include <iostream.h>

#include <conio.h>

class Time

{

int h,m,s;

public:

Time()

{

h=0, m=0; s=0;

}

void setTime();

void show()

{

cout<< h<< ":"<< m<< ":"<< s;

}

//overloading '+' operator

Time operator+(time);

};

Time Time::operator+(Time t1) //operator function

{

Time t;

int a,b;

a = s+t1.s;

Hope it is helpful

please mark as brainliests

Answered by Itzbranilyking
0

Answer:

ok

Explanation:

Please make us brinnest

Similar questions