B
BobRoyAce
Let's say I have a class called ClassA which has a bunch of member
variables, properties, private and public methods. Then, let's say
that I want to create another class, ClassACalcEngine, that will do
certain calc's related to ClassA, but together with some fields that
would be populated just for the calc's...not related to ClassA itself
(e.g. PeriodBeginDate, PeriodEndDate, etc.). However, to perform the
calculations, ClassACalcEngine needs access to certain property
values, and public methods, of ClassA. What is the best way to
implement something like this?
I had originally thought that I'd have a member variable in ClassA
which was an instance of a ClassACalcEngine. However, I don't know how
the ClassACalcEngine will have access to the needed properties and
methods of ClassA. It should be noted that ClassACalcEngine would only
ever calculate things for a ClassA (i.e. has no value unless
associated with a ClassA).
variables, properties, private and public methods. Then, let's say
that I want to create another class, ClassACalcEngine, that will do
certain calc's related to ClassA, but together with some fields that
would be populated just for the calc's...not related to ClassA itself
(e.g. PeriodBeginDate, PeriodEndDate, etc.). However, to perform the
calculations, ClassACalcEngine needs access to certain property
values, and public methods, of ClassA. What is the best way to
implement something like this?
I had originally thought that I'd have a member variable in ClassA
which was an instance of a ClassACalcEngine. However, I don't know how
the ClassACalcEngine will have access to the needed properties and
methods of ClassA. It should be noted that ClassACalcEngine would only
ever calculate things for a ClassA (i.e. has no value unless
associated with a ClassA).