What does : mean?
I have 2 classes:
class base {
virtual void foo() {};
};
class derived : public base {
void foo() { base::foo(); }
};
I made a mistake and wrote base:foo();
instead of base::foo();
. The code was compiled and run, but segfaulted.
I don't know how I can Google it and don't know what it is, but I'm very interested: what does that mean?
base:foo();
If it is important:
class base : public QAbstractGraphicsShapeItem
void foo() { base:foo(); }
is equivalent to:
void foo()
{
base: // An unused label.
foo(); // Calls the function again, resulting in infinite recursion.
}
Due to infinite recursion, the function causes stack overflow.