I am a newbie and trying to understand concepts of inheritance and design patterns.
I came across this pattern http://en.wikipedia.org/wiki/Strategy_pattern when I w
Put really simply:
A Derived class (or subclass) is an instance of its base class.
So, when you pass an instance of ConcreteStrategyAdd
into the constructor, you are essentially passing a Strategy
object in.
There is no casting involved. The type hierarchy allows for this type of programming. It allows programmers to use polymorphism in their code.