Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
VC++ fail
#include <iostream> struct Base { virtual int foo() { return 404; }; }; struct A : Base { int foo() override { return 1; } }; struct B : Base { int foo() override { return 2; } }; namespace { bool shouldCreateA() { return false; } } int main() { Base&& obj = shouldCreateA() ? static_cast<Base&&>(A{}) : static_cast<Base&&>(B{}); std::cout << obj.foo(); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Test
hangman
du
boost::asyc fail with error C2280: attempting to reference a deleted function
C++ standard violation: [templates][explicit instantiation][access checking]
calling conventions and using an override class to change another classes values
MSVC14 <exception> header
VS struct name enumerate
bad_cast
Catching divide-by-zero with /EHc
Please log in to post a comment.