business rules

  • Thread starter Thread starter hireprabhu
  • Start date Start date
H

hireprabhu

Hi,
Can somebody let me know what is the best way to implement the
business rules. I am quite new to C# & oops

Class A {
Function Busrules { base class rules must run}
}

Class B: A {
Function Busrules { Having its own rules.}
}

When I create object of class B and call Busrules it should first run
the base class rules and then the class B rules..

How to implement this..

Thanks
 
Can somebody let me know what is the best way to implement the
business rules. I am quite new to C# & oops

Class A {
Function Busrules { base class rules must run}
}

Class B: A {
Function Busrules { Having its own rules.}
}

When I create object of class B and call Busrules it should first run
the base class rules and then the class B rules..

How to implement this..

I suspect you mean a call like this:

base.BusRules()

within B.BusRules.
 
Hi,
Can somebody let me know what is the best way to implement the
business rules. I am quite new to C# & oops

Class A {
Function Busrules { base class rules must run}
}

Class B: A {
Function Busrules { Having its own rules.}
}

When I create object of class B and call Busrules it should first run
the base class rules and then the class B rules..

How to implement this..

Jon has already answered your question, but I have one for you.

Are you sure that using inheritance is the best way to go with this?

I am trying to envision why a business rule might legitimately be a
candidate for subclassing from another business rule. I can think of
reasons why different business rules might share some implementation
details, but that can be handled via composition in a far cleaner
manner.

Would you be able to provide a simplified sample of when this makes
sense?

My concern is that you could run in to trouble if you are attempting to
do something like

Class A --> does X
Class B --> does X and Y

So I subclass A to share the X behavior

Next I need a class that does Y and Z, but not X
What do I do now?
I have already tied my Y logic to the X logic.

Anyway...be fore I go on any further, perhaps you can demonstrate your
usage.
Possibly, it make sense in your business.

Bill
 
Thanks bill for the information.

The requirement is quite simple....

We need to develop a class, which has its own impementation.

Whoever inherit the base class, they should implement the member
function called business rules. I dont want to use abstract functions
as it doesn't have any impementation [There are some implementation
which should be implemented by those who inherit the base]. How do i
do that ?.

Class A{
Void businessrules { Some core implementation}
}

Class B: A
{
Businessrules {
Need to execute the business rules of Base first [Developer
should not have option to avoid this]
Other impementation.
}
 
Back
Top