Created
October 5, 2014 12:06
-
-
Save iluxonchik/6ab073f35ef52232639d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Works | |
std::ostream &operator<<(std::ostream &o, const Cat cat){ | |
o << (Animal&)cat << " Weight: " << cat.weight(); | |
return o; | |
} | |
//Doesn't work | |
std::ostream &operator<<(std::ostream &o, const Cat cat){ | |
o << (Animal*)cat << " Weight: " << cat.weight(); | |
return o; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment