Re: Casting up to inheriting class from base?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Brett Romero" <account@xxxxxxxxx> wrote in message
news:1152202983.560030.210290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Say I have a class inheriting some base class:

BaseClass
{
void Foo()
{
Update();
}
}


Class1 : BaseClass
{
void Update(){}
}


How can I have the base class know which instance class has inherited
it and use a method in the instance class? Only certain types of
classes will use the base and those classes will always have an
Update() method.

It's hard for me to say for sure (since "instance class" isn't really
correct - do you mean "derived class"?), but it's possible you just want to
make Foo() virtual.

///ark


.



Relevant Pages

  • Re: Casting up to inheriting class from base?
    ... Class1: BaseClass ... void Update ... How can I have the base class know which instance class has inherited ... but why can't you just make the base class ...
    (microsoft.public.dotnet.languages.csharp)
  • Virtual function question
    ... If I have a base class with a virtual function defined: ... void CBase::Foo ... // base class functionality ... and a derived class which overrides the base class Foo(): ...
    (comp.lang.cpp)
  • Casting up to inheriting class from base?
    ... Say I have a class inheriting some base class: ... void Update ... How can I have the base class know which instance class has inherited ...
    (microsoft.public.dotnet.languages.csharp)