Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7530367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:53:33+00:00 2026-05-30T04:53:33+00:00

I am using borland turbo C++ complier (4.5). This is my code but i

  • 0

I am using borland turbo C++ complier (4.5). This is my code but i am getting error as follows: Multiple declaration for ‘time::add(time)’.Here i am juss overloading the add() three times the error comes in the 3rd overload i.e in “void add(time t1)”.

 #include<iostream.h>
 #include<conio.h>
 class time
 {
 int h,m;
 public:
 void input()
 {
    cout<<"\n Enter hour :";
    cin>>h;
    cout<<"\n Enter min :";
    cin>>m;
 }
 void display()
 {
    cout<<"\n time is : "<<h<<":"<<m;
 }
 void add(time t1,time t2)
 {
    h=t1.h+t2.h+(t1.m+t2.m)/60;
    m=(t1.m+t2.m)%60;
 }
 time add(time t1)
 {
     time t3;
     t3.h=h+t1.h+(m+t1.m)/60;
     t3.m=(m+t3.m)%60;
     return t3;
 }
 void add(time t1)
 {
    h=h+t1.h+(m+t1.m)/60;
    m=(m+t1.m)%60;
 }
 };
 int main()
 {
    time t1,t2,t3;
    t1.input();
    t2.input();
    t3.add(t1,t2);
    t3.display();
    t3=t2.add(t1);
    t3.display();
    t2.add(t1);
    t2.display();
    return 0;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:53:34+00:00Added an answer on May 30, 2026 at 4:53 am

    In C++, you can’t overload functions solely on return type:

    time add(time t1) {...}
    void add(time t1) {...}
    

    I would suggest replacing the three add() function with overloaded operators + and +=. This would resolve the ambiguity, and would also make it clear which of the operations modify the object, and which return a new object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Borland Builder C++ 2009. I want to add a button to
I have some old code written in C for 16-bit using Borland C++ that
I found this code for a replacement gotoxy() function using C standard library only.
Try this code I created,when I use it in Borland C++ and try the
Possible Duplicate: How can I configure Vim to compile C code using Borland’s compiler
I am using borland 2006 c++, and have following code. I am using vectors,
I am using bcc32 command line compiler from Borland Embarcadero. Consider this program: int
I know this is a darn simple question, but I'm very used to using
I compiled my code using Borland 5.5 and there was no errors that popped
I am using Borland Builder C++. I have a memory leak and I know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.