Skip to content

Instantly share code, notes, and snippets.

@Marqin
Created April 9, 2018 05:55
Show Gist options
  • Save Marqin/fc81eb4cae349257ab0a6d4749739882 to your computer and use it in GitHub Desktop.
Save Marqin/fc81eb4cae349257ab0a6d4749739882 to your computer and use it in GitHub Desktop.
What this will print?
#include <iostream>
class A {
public:
void foo(float x) {
std::cout << x << " is a float." << std::endl;
}
};
class B : public A {
public:
void foo(long x) {
std::cout << x << " is a long." << std::endl;
}
};
int main() {
float x = 1.5;
B b;
b.foo(x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment