Posted By: Rat (prilis mnoho her) on 'CZprogram' Title: Re: g++ & C++y Date: Tue Jan 14 11:33:31 2003 > > Protoze GetRandom neni staticka metoda tak ji musis volat s objektem, tj > > jako > > randClass.GetRandom nebo prandClass->GetRandom anebo uvnitr nestaticky > > metody > > TRandClass. > > Zajimave, volani GetRandom(10) funguje, jedna se totiz o potomka te > TRandClass, takze jsem myslel, ze v tomto chyba nebude. Ale zkusil jsem > this->GetRandom( ...) a chyba uz neni, jak to? Hm, a nemas ji treba v necem pretizenou? Poznamka pod okraj - vyser se na ty stupidni mikrosofti konvence jako m na zacatku member-promenne... > Predchozi verze programu padala pri volani virtualni funkce na Seg.fault. > Nevite nekdo co s tim? kod vypada takto: > > class A > { > public: > > void fce1() > { > ... > vfce1(); > ... > } > protected: > virtual void vfce1() > { > ... > } > }; > > class B:public A > { > protected: > virtual void vfce1() > { > ... > } > }; > > class C:public B > { > public: > void Run() > { > ... > fce1(); > } > }; > > V Run() se spravne zavola fce1(), ale kdyz se uvnitr ni pokousim volat to > vfce1(), tak mi to padne na Seg.fault. Jaka verze kompilatoru? Mi to s Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.2/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux Thread model: posix gcc version 3.2.2 20030109 (Debian prerelease) funguje. A popravde, neni duvod aby ne, mas nekde blbe neco jinde (drivejsi prepis pameti apod., nevim). Korusef[ Libor Dener] > (-: CauCau :-) Krysa rat@atrey.karlin.mff.cuni.cz Jsem Krysa http://atrey.karlin.mff.cuni.cz/~rat/