Re: UnOverRideable member functions?

From: Jerry Coffin (jcoffin_at_taeus.com)
Date: 03/04/05


Date: 3 Mar 2005 21:47:15 -0800

Michael P. O'Connor wrote:
> Is it possible to define a member function of an object to be
> Un-OverRideable?
>
> The function also needs to be seen by the outside world so it can not
> be a private member.

Yes, but only on a tecnicality -- only virtual functions can be
overridden, so a non-virtual function is un-overridable.

OTOH, a derived class can still create another function with the same
name, hiding the base class function even if its not virtual (though
some tools will warn about this, since it's rarely desirable).

--
    Later,
    Jerry.
The universe is a figment of its own imagination.


Relevant Pages

  • Re: Member Functions
    ... > will have a pointer to a single function. ... > If I were to implement this as a class with a member function ... each instance of a class which has a vtbl includes just a pointer ... before saying "virtual functions are expensive", ...
    (alt.comp.lang.learn.c-cpp)
  • Re: getting an objects type
    ... > I'm writing code with a whole lot of inheritance and am finding myself ... > constructors (and getting the type through a member function.) ... At complie time by using templates ... Virtual functions should work in general. ...
    (comp.lang.cpp)
  • Re: a+b+c is not equal to a+(b+c)
    ... Virtual functions must be members. ... Everything else should be a member function. ... In a 2000 article Scott Meyers updated this formula in an article entitled "How ... I think it is a neat read and it creates a definition of encapsulation that is ...
    (comp.lang.cpp)
  • Re: Importing C Classes from a DLL
    ... >member function inside a VB program. ... might be possible is by using APIs but I'm not sure how it would be done, ... maybe something excists similar to LoadLibrary? ... Michael ...
    (microsoft.public.vb.enterprise)