Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current method does not prevent calling virtual functions of intermediate classes. #10

Open
HyeockJinKim opened this issue Apr 19, 2018 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed invalid This doesn't seem right

Comments

@HyeockJinKim
Copy link
Owner

Current method does not prevent calling virtual functions of intermediate classes.

class A {
};

class B : public A {
public:
    virtual void g() {}
};

class C : public B {
};

int main() {
    A * t1 = new A;
    C * t2 = static_cast<C*>(t1);
    t2->g(); // function call posiible
    return 0;
}
@HyeockJinKim HyeockJinKim added bug Something isn't working help wanted Extra attention is needed invalid This doesn't seem right labels Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant