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

Operator Overloading #11

Open
jimin-kiim opened this issue Oct 20, 2022 · 0 comments
Open

Operator Overloading #11

jimin-kiim opened this issue Oct 20, 2022 · 0 comments

Comments

@jimin-kiim
Copy link
Owner

operator overloading

  • redefining operators as functions to make if work for user defined types
  • member function method
    • use this keyword to implicitly get argument
    • get left operand for binary operators (like +)
    • leftmost object must be of same class as operator
  • non member function method
    • need parameters for both operands
    • can have object of different class than operator
    • must be a friend to access private and protected data
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

No branches or pull requests

1 participant