SORU
22 Mayıs 2015, Cuma


Ne yapar:?

2 Ders var:

class base {
    virtual void foo() {};
};

class derived : public base {
    void foo() { base::foo(); }
};

Bir hata yaptım ve base::foo(); yerine base:foo(); yazdı. Kod derlenmiş ve çalıştırmak, ama segfaulted.

Google ve ne olduğunu bilmiyorum nasıl olduğunu bilmiyorum, ama çok merak ediyorum: Bu ne anlama geliyor?

base:foo();

Önemli ise:

class base : public QAbstractGraphicsShapeItem

CEVAP
22 Mayıs 2015, Cuma


void foo() { base:foo(); }

eşittir:

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

Sonsuz özyineleme nedeniyle, işlevi yığın taşması neden olur.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Excel Video Tutorials

    Excel Video

    6 Aralık 2012
  • super1988guy

    super1988guy

    9 Aralık 2007
  • Vagrant Records

    Vagrant Reco

    8 Mayıs 2006