Skip to content

Instantly share code, notes, and snippets.

@guludo
Created August 24, 2015 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guludo/2a9eece3fbbe114c0cf9 to your computer and use it in GitHub Desktop.
Save guludo/2a9eece3fbbe114c0cf9 to your computer and use it in GitHub Desktop.
class A {
public:
virtual void foo(int a, int b = 1) = 0;
};
class B : public A {
public:
void foo(int a, int) {
}
};
int main() {
B b;
b.foo(1);
return 0;
}
@lucasdemarchi
Copy link

with this small change, it works, which should be the case in our codebase:

class A {
public:
    virtual void foo(int a, int b = 1) = 0;
};

class B : public A {
public:
    void foo(int a, int) {
    }
};

int main() {
    A *b = new B();
    b->foo(1);
    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment