Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does : mean?

Tags:

c++

syntax

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 
like image 718
railmisaka Avatar asked May 22 '15 02:05

railmisaka


People also ask

What d means?

(colloquial) Contraction of what did. What'd he say to you? (colloquial) Contraction of what would.

What does (!) Mean in texting?

An exclamation point is a form of punctuation that is used to add emphasis or express strong emotion (especially excitement). The role of the exclamation point does not change based on the given medium (it has the same effect in a book as it does in a text message).

What can it mean?

Definition of can it : to stop talking : to shut up I wish you'd just can it!


1 Answers

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.

like image 72
3 revs, 2 users 97% Avatar answered Sep 20 '22 16:09

3 revs, 2 users 97%