Link to home
Start Free TrialLog in
Avatar of David Glover
David GloverFlag for United Kingdom of Great Britain and Northern Ireland

asked on

The appropriate class structure to hold this?

I have a KPI which consists of a set of measures which are scored in different ways but each of which use some of the same data to determine a score.
So far I have a VB .net class:

Class KPI
    public property DateStart as datetime
    public property DateEnd as datetime
    public property CVSent as cPerformance
    public property SalesLeadsGenerated as cPerformance
    public property Interviews as cInterest
    public property ClientCalls as cInterest
End Class

cPerformance and CInterest inherit from another class cScore.  Each of these has a score property which includes its own particular way of determining a score but common to both, they need DateStart/DateEnd from the creating class order to calculate the score.
This suggests to me that either these classes need a reference to their creator or the values passing as constructors.
I wanted it so that when we 'Get' the score it calculates and that makes me think its not really a constructor I want to use since the datestart and dateend may be altered after construction which will affect the score.

So there for I am leaning towards passing a reference to the parent class but from what  I understand this is bad practice and there is probably right way to do it...
Can anybody suggest what I should be doing or confirm if this is the right approach?
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Classes in .NET are always passed by reference. Structs are passed by value. There is (typically) more overhead with a struct because a copy of the struct is created before it is passed.
Avatar of David Glover

ASKER

As above