def var oClassA as myClass no-undo.
def var oClassB as myClass no-undo.
def var oClassC as myClass no-undo.
:
:
def var oTmp as myClass no-undo.
if something then oTmp = oClassA else if somethingelse then oTmp = oClassC ......
run myStandardProcedure.
myStandardprocedure:
if valid-class(oTmp) then do:
use oTmp for all stuff related to the other classes....
end.
Use an Interface that described the similarities between all those classes.
<ProgressEmailLogo-png_2D00_150x42x2-png> Update from Progress Community
goo def var oClassA as myClass no-undo.
def var oClassB as myClass no-undo.
def var oClassC as myClass no-undo.
:
:
def var oTmp as myClass no-undo.
if something then oTmp = oClassA else if somethingelse then oTmp = oClassC ......
run myStandardProcedure.
myStandardprocedure:
if valid-class(oTmp) then do:
use oTmp for all stuff related to the other classes....
end.
You received this notification because you subscribed to the forum. To stop receiving updates from only this thread, go here.
Flag this post as spam/abuse.
Sorry, it seems that I can do oTmp = oClassB etc... I didn't thought that I could use a class as a variable pointer...
so why not pass the reference to the class as a parameter to myStandardProcedure instead of using oTmp? This seems like bad practise to me (no encapsulation)...
if the classes are the same (and it looks like they are) then you should new myclass with constructor data to populate the values rather than having 3 instances
def var oMyClass as myClass no-undo. if something then oMyClass = new myClass(somethingdata) else if somethingelse then oMyClass = new myClass(somethingelsedata) etc run myStandardProcedure. myStandardprocedure: if valid-class(oMyClass) then do: use oMyClass for stuff end.
then pass A, B or C as a parameter to myStandardProcedure
…make instances
… loop:
Run myStandardProcedure(oClassA).
Run myStandardProcedure(oClassB).
Run myStandardProcedure(oClassC).
….endloop.
myStandardprocedure:
def input parameter pClass as myClass no-undo.
if valid-class(pClass) then do:
use pClass for stuff
end.
I thought about that, but then I needed to have some logic extracted from the procedure. What is wrong with having a dummy class being a handle to the classes? Is it structural wrong? Slow?
Update from Progress Community
jmls then pass A, B or C as a parameter to myStandardProcedure
…make instances
… loop:
Run myStandardProcedure(oClassA).
Run myStandardProcedure(oClassB).
Run myStandardProcedure(oClassC).
….endloop.
myStandardprocedure:
def input parameter pClass as myClass no-undo.
if valid-class(pClass) then do:
use pClass for stuff
end.
You received this notification because you subscribed to the forum. To unsubscribe from only this thread, go here.
Flag this post as spam/abuse.