Created
April 3, 2016 16:26
-
-
Save b4284/ae768330485cfae17bd529ef0bc5d55e 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
| #include <iostream> | |
| class Aab { | |
| public: | |
| int b_ = 0; | |
| float c_ = 0; | |
| Aab(int b) { | |
| this->b_ = b; | |
| } | |
| Aab(float b) { | |
| this->c_ = b; | |
| } | |
| void print(void) { | |
| if (this->b_) { | |
| std::cout << b_ << std::endl; | |
| } else if (this->c_) { | |
| std::cout << c_ << std::endl; | |
| } | |
| } | |
| }; | |
| void tryy(Aab b) { | |
| b.print(); | |
| } | |
| int main(void) { | |
| tryy(1); | |
| tryy(1.1f); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment