Skip to content

Added implementation of Not_Equal_To#29

Open
mangodo100 wants to merge 1 commit into
ayaankhan98:mainfrom
mangodo100:main
Open

Added implementation of Not_Equal_To#29
mangodo100 wants to merge 1 commit into
ayaankhan98:mainfrom
mangodo100:main

Conversation

@mangodo100
Copy link
Copy Markdown

No description provided.

@divy9881
Copy link
Copy Markdown

divy9881 commented Oct 5, 2020

Fix #28

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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