Registriert seit: 17. Mai 2007
482 Beiträge
Delphi XE6 Professional
|
Need create and call method from many class types
6. Jan 2011, 20:26
Delphi-Version: 2010
Hello, guys,
So, lets say what I have.
I have two classes:
- TClass1(TBaseClass)
- TClass2(BaseClass)
TClass1 and TClass2 extands TBaseClass, both are for different input data types. TClass1/TClass2 has LoadFromStream and SaveToStream.
Now, how to create and call methods with names that are common for any class TSomeOtherClass(TClass1/TClass2), like stream procedures?
Currently I have:
if class = someclass then someclass.loadfromstream
else if class = otherclass then otherclass.loadfromstream
else if class = yetanotherclass then yetanotherclass.loadfromstream
but in future I'll have too many classes to add if statement in few places in few units in program.
Could you help with this?
|