What means?

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 has been compiled and run, but compromised.

I don’t know how I can do this Google and I don’t know what it is, but I’m very interested: what does it mean?

 base:foo(); 

If this is important:

 class base : public QAbstractGraphicsShapeItem 
+86
c ++ syntax
May 22 '15 at 2:31
source share
1 answer
 void foo() { base:foo(); } 

equivalent to:

 void foo() { base: // An unused label. foo(); // Calls the function again, resulting in infinite recursion. } 

Due to infinite recursion, the function causes a stack overflow.

+115
May 22 '15 at 2:44
source share



All Articles