Brad Thanks, your absoluteley right BUT I didn't know that. I'll be sure to reference the standard before posting in the future.
N PS It'd probably make a good interview question ! ----- Original Message ---- > From: Brad King <[EMAIL PROTECTED]> > To: Nindi Singh <[EMAIL PROTECTED]> > Cc: [email protected] > Sent: Saturday, 2 February, 2008 2:21:35 PM > Subject: Re: [GCC-XML] virtual function > > Nindi > Singh > wrote: > > > class > Base > { > > > > public: > > > > > virtual > void > func()=0; > > > }; > > > > > class > Derived:public > Base > { > > > > public: > > > > > void > func(){} > > > }; > [snip] > > > I > am > curious > the > method > 'func' > in > class > Derived > is > described > as > virtual. > Its > not. > If > I > am > missing > something, > then > how > can > I > tell > whether > a > function > 'may' > be > overloaded > in > a > derived > class > or > not. > > Yes, > it > is > declared > virtual. > It > does > not > matter > whether > the > virtual > keyword > is > present. > If > there > is > a > function > with > the > same > signature > in > the > parent > class > that > is > declared > virtual > it > implicitly > makes > your > function > virtual. > This > is > a > C++ > rule. > > If > instead > you > write > > class > Base > { > > > public: > > > > virtual > void > func()=0; > }; > class > Derived: > public > Base > { > > > public: > > > > void > func(int) > {} > }; > > then > Derived::func > is > not > virtual > because > it > does > not > match > the > signature > from > Base::func. > Instead > you > will > be > left > with > an > abstract > class > because > Base::func > is > pure-virtual > so > it > must > be > defined > in > Derived > to > make > it > a > concrete > type. > > -Brad > > ___________________________________________________________ Support the World Aids Awareness campaign this month with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/ _______________________________________________ gccxml mailing list [email protected] http://www.gccxml.org/mailman/listinfo/gccxml
