Mailing List archive

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

[vdr] Re: Coding question



Hi Christian :)

> Hi,
>
> it not neccessary to use the virtual keyword in sub classes, but it is
often
> used as a reminder, that the base function is virtual.
Thanks for this info... but i will say by my habit and dont will use the
keyword virtual
in a childclass.


Greets,
Christian

>
> On Thursday 03 June 2004 11:42, Christian Gmeiner wrote:
> > Hi Mailingliste,
> >
> > i have here a question about coding.
> >
> > Klaus uses abstract (virtual) classes, but why is he also using the
virtual
> > keyword in this way:
> >
> > class cDvbDevice : public cDevice {
> > private:
> >   static bool Probe(const char *FileName);
> >          ///< Probes for existing DVB devices.
> > public:
> >   static bool Initialize(void);
> >          ///< Initializes the DVB devices.
> >          ///< Must be called before accessing any DVB functions.
> >          ///< \return True if any devices are available.
> > private:
> >   fe_type_t frontendType;
> >   int fd_osd, fd_audio, fd_video, fd_dvr, fd_stc;
> > protected:
> >   virtual void MakePrimaryDevice(bool On);
> > public:
> >   cDvbDevice(int n);
> >   virtual ~cDvbDevice();
> >   virtual int ProvidesCa(const cChannel *Channel) const;
> >   virtual bool HasDecoder(void) const;
> >
> > // SPU facilities
> >
> > private:
> >   cDvbSpuDecoder *spuDecoder;
> > public:
> >   virtual cSpuDecoder *GetSpuDecoder(void);
> >
> > // Channel facilities
> >
> > private:
> >   cDvbTuner *dvbTuner;
> >   void TurnOffLiveMode(void);
> > public:
> >   virtual bool ProvidesSource(int Source) const;
> >   virtual bool ProvidesTransponder(const cChannel *Channel) const;
> >   virtual bool ProvidesChannel(const cChannel *Channel, int Priority
= -1,
> > bool *NeedsDetachReceivers = NULL) const; protected:
> >   virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
> > public:
> >   virtual bool HasLock(void);
> >
> >
> > I always thought that i only need to use virtual on the motherclass and
the
> > childclass dont need it. In my biggest project, a game engine, i dont
use
> > virtual in the childclass. Could somebody explain this to me?
> >
> > Thanks, Christian
>
> -- 
> Viele Grüße
> Christian
>






Home | Main Index | Thread Index