Re: Can my class tell if one of its virtual members is overloaded?



Tony Maresca <tony@xxxxxxxxxxxxx> wrote:
> When you say "the base class doesn't know anything
> about the derived classes",
>
> Um, not sure about that. If my base class can get the
> type of an instance of a derived class, how can we say
> that a base class cannot discover anything about derived
> classes, at runtime?
>
> Are you absolutely sure about that?

The point is that you can never know what all the derived classes of a
type are, unless it's internal. So although all the created instances
of derived types may not override a member, that doesn't mean there
isn't another type around which *does* override a member.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Not pure virtual functions and mixing virtual and non virtual methods
    ... Should I call base class implementation or not? ... But doing the above assumes that one answer is good for all, that all derived classes will want the base class method called in the same way. ... More generally, the way I see it, if you combine invariant implementation with variant parts, you have no elegant way to change the variant part. ... Following them will remove all inheritance relationships. ...
    (comp.object)
  • Re: Why cant static methods be overridden?
    ... static void something ... but if it were possible to override ... something in derived classes you can bet people would then want to be able ... to call derived static methods through base class references, ...
    (comp.lang.java.programmer)
  • This one took weeks to resolve
    ... would be better designed as deriving from a base class form. ... control in the Windows generated code. ... These derived classes where the only place in a project ... Private sub Btn_ClickHandles btn.click ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How many bytes per Italian character?
    ... override the InitState() function so it needs to be pure virtual. ... derived classes call up to them anyway; ... both the base class and derived class. ...
    (microsoft.public.vc.mfc)
  • Re: Inheritance and Interfaces
    ... Talk about having a "duh" moment. ... >You only need to implement INotifyPropertyChanged in the base class, ... > Public Property NameAs String ... >The Overridable Sub OnPropertyChanged allows derived classes to raise ...
    (microsoft.public.dotnet.languages.vb)

Quantcast