Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: ANNOUNCE: VdrTetris-Plugin-0.2.2



Clemens Kirchgatterer wrote:
> 
> Klaudius.Chlebosch@t-online.de (Klaudius Chlebosch) wrote:
> 
> > > anyway, you may try to declare ~GameTetris() and Show() (lines 29 &
> > > 30) in plugin.cpp as virtual, so they look like this:
> > >
> > > class GameTetris : public cOsdObject {
> > > public:
> > >    virtual ~GameTetris()   { tetris_stop(); }
> > >    virtual void Show(void) { tetris_start(x, y, s, c); }
> > >    eOSState ProcessKey(eKeys Key);
> > > };
> > >
> > > note, that i don't expect this to work! ;-) but you could try
> > > anyway.
> > >
> >
> > in most cases it is a VERY good idea to declare a destructor virtual
> > if you use inheritance. Especially if the class to inherit from is
> > designed for this purpose ( and cOsdObject has a virtual destructor in
> > 1.1.20 ). Are you shure that your non-virtual ~GameTetris is ever
> > called ?
> 
> IMHO, it does not matter, if a methode is declared virtual in the
> chiled class. it has to be virtual in the base class, though.
> and of'course it would make a difference, if i would derive from
> GameTetris afterwards.
> 
> but, i'm not 100% shure about this. :-) if anybody could make a clear
> statement?
> 
> thx ...
> clemens

Once a class member function is declared virtual it is virtual
in all derived classes, too. So there is no need to repeat the 'virtual'
keyword in the derived classes - but personally I like to have the 'virtual'
in the derived classes, too, just to see at a glance what's going on.

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index