Hi,
I am tring to implement a time class as follows:
class HMS{
public:
// constructors
// accessors
// modifiers
HMS add (const HMS & x, const HMS & y);
HMS subtract (const HMS & x, const HMS & y);
private:
// private variables / methods
int hrs;
int mins;
int secs;
The add method adds the hours, minutes and seconds of the the two objects passed and is supposed to return the sum. However, I am wondering if this is possible...can the add method return an object of the class HMS? If so, how is it done? So far, I only know about the return statement returning integer, double , string types ect.
Please Help.
Thanks
Saff
I am tring to implement a time class as follows:
class HMS{
public:
// constructors
// accessors
// modifiers
HMS add (const HMS & x, const HMS & y);
HMS subtract (const HMS & x, const HMS & y);
private:
// private variables / methods
int hrs;
int mins;
int secs;
The add method adds the hours, minutes and seconds of the the two objects passed and is supposed to return the sum. However, I am wondering if this is possible...can the add method return an object of the class HMS? If so, how is it done? So far, I only know about the return statement returning integer, double , string types ect.
Please Help.
Thanks
Saff