Skip to content

Instantly share code, notes, and snippets.

@b4284
Created April 3, 2016 16:26
Show Gist options
  • Select an option

  • Save b4284/ae768330485cfae17bd529ef0bc5d55e to your computer and use it in GitHub Desktop.

Select an option

Save b4284/ae768330485cfae17bd529ef0bc5d55e to your computer and use it in GitHub Desktop.
#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