AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Need create and call method from many class types
Thema durchsuchen
Ansicht
Themen-Optionen

Need create and call method from many class types

Ein Thema von WojTec · begonnen am 6. Jan 2011 · letzter Beitrag vom 10. Jan 2011
 
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Need create and call method from many class types

  Alt 6. Jan 2011, 19: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?
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:49 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz