[fpc-devel] Abstract functons with parameters on classes

ik idokan at gmail.com
Thu Jul 27 20:06:28 CEST 2006


On 7/27/06, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> On 27 Jul 2006, at 17:49, ik wrote:
>
> > The issue is that TA is an abstract class, while TA2 and anything else
> > will inherit this class, but will implement different things/ways of
> > things ... so the "fnc" function will need a different structure on
> > each class.
>
> What is the use of having an abstract fnc in the base class? I don't
> understand what you want to do. For calling these differently
> structured "overloads" you have to typecast your class to TA2 or so
> anyway, unless you declare all these variants also as virtual
> abstract methods in your base class (in which case your problem is
> immediately solved, but I don't really see the use of that because
> you can't have generic code when calling any of these methods anyway).

My wish to to make sure that the classes have the same function names,
that only it's parameters are different depending on the need ....

For example, loading from a file, or getting information from a
stream... every child class will do something else that will result in
the same type of action (like TBitmap, TJpeg etc.. that are based on
the same abstract, but does something different in order to allow us
to work with the image type).

>
>
> Jonas

  Ido



More information about the fpc-devel mailing list