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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:26:18+00:00 2026-06-13T10:26:18+00:00

This is really bugging me. I’m working on overloading the comparison operators in C++,

  • 0

This is really bugging me. I’m working on overloading the comparison operators in C++, and I’m getting a weird error that I’m not sure how to correct.

The code I’m working with looks like this:

bool HugeInt::operator==(const HugeInt& h) const{
    return h.integer == this->integer;
}

bool HugeInt::operator!=(const HugeInt& h) const{
    return !(this == h);
}

where integer is a short [30]

The == overloading works fine. But when I try to use it in the != body, it tells me that == has not been defined. I’m new to C++, so any tips are welcome.

  • 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-13T10:26:19+00:00Added an answer on June 13, 2026 at 10:26 am

    You’re trying to compare a pointer and an instance. this is a pointer to the current object, you need to dereference it first.

    Anyway, you’ve mentioned that integer is an array of shorts. That probably means you shouldn’t compare it with == – you should just compare all the elements manually (after, of course, you check that the number of elements in the arrays is the same, in case they can be filled partially). Or you could use a vector as Luchian suggested – it has a well-defined operator==.

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

Sidebar

Related Questions

Ok I have this problem that I've never had before, it's really bugging me.
I've got this really simple piece of code that I thought was the correct
It's not the first time I'm having this problem, and it's really bugging me.
Eclipse is really bugging me with this. I have an Android project that is
I've been having this really annoying thing happen the past few days, that has
I have the following code that is really bugging me, I'm thinking perhaps the
This is really bugging me. I'm using a GridView and want to format it
I know this is a dumb question, but its really bugging me. Take the
This is really bugging me, so I hope someone can help me a bit
This issue has been bugging me for the past several days. I've been working

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.