Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Added implementation of Not_Equal_To #29

wants to merge 1 commit into from

Conversation

mangodo100
Copy link

No description provided.

@divy9881
Copy link

divy9881 commented Oct 5, 2020

Fix #28

Copy link
Owner

@ayaankhan98 ayaankhan98 left a 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

@mangodo100
Copy link
Author

yeah sure

Comment on lines +35 to +48
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;
}
Copy link
Contributor

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.

Copy link
Owner

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants