-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added implementation of Not_Equal_To #29
base: main
Are you sure you want to change the base?
Conversation
Fix #28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me
can you implement the possible overloads of != operator along with the tests
yeah sure |
bool largeInt:: operator != (const largeInt& z) { | ||
if(this->sign != z.sign) { | ||
return true; | ||
} | ||
if (this->number.length() != z.number.length()) { | ||
return true; | ||
} | ||
for(int i = 0; i < this->number.length(); i++) { | ||
if (this->number[i] != z.number[i]) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this have to be so complex? Operator == is already overloaded.
bool largeInt:: operator != (const largeInt z) {
return !(*this == z);
}
This much code should be fine. Plus it will always be in sync with == operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually this PR was made before the overloading of ==
operator.
i was thiking to request changes on this
thanks @ufrshubham for pointing out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, that makes sense.
No description provided.