Topic: Question overloading methods
Author: jean-claude.bourut@gsi.fr (JClaude Bourut)
Date: Sun, 6 Mar 1994 10:49:51 GMT Raw View
I have a set of classes that inherit from a root class named Storable. A
second set of classes inherit from another class named IC. Each IC class
contains a method check taking one storable subclass as parameter:
class StorableA : public Storable { ... } ;
class StorableB : public Storable { ... } ;
class StorableC : public Storable { ... } ;
class IC_A : public IC { ... check( StorableA &) ; } ;
class IC_B : public IC { ... check( StorableB &) ; } ;
class IC_C : public IC { ... check( StorableC &) ; } ;
Appart different signature, these methods do exactly the same job with the
same kind of parameter. For the rest of my lib, I cast back and forth Storable
to one of its subclass. But here, I must call various APIs. I would like all
these check methods to overload a check method in my IC root class.
I already know, I could use a generic method named check( Storable &), but
this would not be a correct API to people writing the body of these methods.
Do you feel this correct ?
Do you have any suggestion to achieve this ?
Thanks