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 7740201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:43:00+00:00 2026-06-01T08:43:00+00:00

Heloo, I’m having trouble with overloading the / operator in a member function within

  • 0

Heloo, I’m having trouble with overloading the / operator in a member function within a template class. I get the error ‘error C2805: binary ‘operator /’ has too few parameters’ but I think I’m giving the operator enough parameters. Here is part of my header file code

template <class T>
typename complex<T>::complex operator/(complex<T> &c)  
{  
    complex temp; 
    temp.re = (re*c.getRe() + im*c.getIm())/(pow(c.getRe(),2)+pow(c.getIm(),2));    
    temp.im = (im*c.getRe() - re*c.getIm())/(pow(c.getRe(),2)+pow(c.getIm(),2)); 
    return temp;  
}

My function declaration is given below

T operator/(complex<T> &c); 

My declaration is indside the class template and the declaration outside, but within the same namespace. If you need the whole code please let me know. Thank you.

  • 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-06-01T08:43:02+00:00Added an answer on June 1, 2026 at 8:43 am

    You are missing the class prefix in the operator definition:

    complex<T>::operator /(complex<T> &c)
    

    Also, you declared the operator as returning T – why are you returning complex in the definition?

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

Sidebar

Related Questions

Helo everyone. I have a class MyClass and a function escape () that can
Hello I am compiling a program with make but I get the error of
Hello I have the following code namespace ConsoleApplication2 { class Program { static void
Hello everyone I'm currently having 2 issues with the code below: Upon return of
Hello I wrote an application and while deploying shows error in line mCamera=Camera.open(); Where
hello friends i am trying to get a list of user id and want
Hello Guys I am trying to figure out why i am gettings this error
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello can anybody solve this please I'm creating the object in the action class
hello im am getting JS error : Uncaught SyntaxError: Unexpected identifier here <script type=text/javascript>

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.