class Calculations{ public enum EProducts{ ProductA, ProductB, ProductC } // here is the member variable EProducts mProduct; // and here is the property public EProducts Product { get {return this.mProduct;} set {this.mProduct = value;} } . . . }Then, when you instantiate the class, you set the Product property:
Calculations oCalc = new Calculations(); oCalc.Product = Calculations.Eproducts.ProductA; double Premium = oCalc.Premium(Age, Duration);Another choice is to initialize the Product type in the class constructor:
class Calculations{ public enum EProducts{ ProductA, ProductB, ProductC } // here is the member variable EProducts mProduct; // here is the class constructor: public Calculations(EProducts Product) { this.mProduct = Product; } . . . }Then, when you instantiate the class:
Calculations oCalc = new Calculations(Calculations.Eproducts.ProductA); double Premium = oCalc.Premium(Age, Duration);Note that because public enums are static, you don't instantiate the class to reference them.
>class Calculations{ > >public enum EProducts{ >ProductA, >ProductB, >ProductC >} > >// set member productvariant: (for now hardcoded, but how to set it using communication with other classes (because there it is set): > >EProducts mProduct = EProducts.ProductA; > >function double Premium(int age, int duraion){ >// code > >} >function double RiskPremium(int age,int duration){ >// dependent on the product variant do an alghortim. >switch(mProduct){ >case EProducts.ProductA: > // alghoritm A > >etcetera > >} > > >} >>