c# - What design pattern to use when I want only some derived classes to have access to a method in base class? -



c# - What design pattern to use when I want only some derived classes to have access to a method in base class? -

i have unique problem/situation here. trying create simple possible. have base of operations class (say parent) , whole bunch of derived classes (say child1, child2 ..childn) straight deriving base of operations class (parent). want alter base of operations class , add together "averyprivilegedmethod" accessible child2 , child3 , not other children (or create configurable such in future child5 can utilize in future, minimal changes). design pattern /architectural pattern fit bill?

language used - c#.

ps: thinking using internalvisibleto realize gets applied @ assembly level

it sounds though you're missing abstract class (specialchild want of improve name) inherits parent child2 , child3 derived.

parent | |------------------|------------|----------| child1 specialchild child4 child5 | |---------------------| child2 child3

ask question: different child2 , child3 such share mutual behaviour themselves, have different behaviour of other children? specialchild models behaviour , in illustration gave in question place implement averyprivilegedmethod.

c# design-patterns architectural-patterns object-oriented-analysis

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -