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

  • Hot For Nutrition

    Hot For Nutr

    26 ŞUBAT 2007
  • TSE

    TSE

    12 Kasım 2012
  • Xbox

    Xbox

    1 Kasım 2005