Sharing Calculated facts between Ediatble object and info object

Sharing Calculated facts between Ediatble object and info object

Old forum URL: forums.lhotka.net/forums/t/3847.aspx


Maqster posted on Tuesday, November 06, 2007

Hi,

in many cases I have calculated facts in an Editable object like this:

public int SumAandB()
{
    get{return A+B};
}

Then when I start making readonly objects I need to copy the already implemented facts.

Does anyone have any ideas on how to share this functionallity between objects, and not just by making an interface that will just give me a must implement and I need the actual implementation. This would be good for reporting too.

Best regards
Maqster


ajj3085 replied on Tuesday, November 06, 2007

Create a third class that has the methods to calcualte the fields you need.  You probably want to define a common interface on both editable and readonly objects so that this third class need only one implementation for either object.

HTH
Andy

Copyright (c) Marimer LLC