Reputation: 833
I have a class structure like this:
class A{
public:
void foo();
};
class B: public A{
public:
void foo();
};
The implementation of B::foo() is like:
void B::foo(){
A:foo();
}
Clearly, I made a mistake typing '::', but the compiler didn't complain. When I ran the program, it ran as if I had typed:
void B::foo(){
foo();
}
Can anybody explain this within the C++ standard? Is it really valid code, or a likely bug in the compiler (MS Visual Studio 2012) ?
Upvotes: 1
Views: 46
Reputation: 103733
A:
a label, for use with a goto
statememt.
void B::foo(){
goto A;
std::cout << "this will be skipped";
A:foo();
}
Upvotes: 3