https://github.com/iamagithublearner/DuckSimulator
i am trying to make a duck simulator (using factory design pattern so maybe i can learn that design pattern)
i have a duck base class , 2 sub classes , MallardDuck and RedHeadDuck
So according to the design pattern , i have to separate things that change from things that do not change.
things that change would be , the behaviors , flyingBehavior and QuackingBehavior since each duck might have diff fly and quack behaviors.
Currently the Base class has 2 instance variable: flyBehavior and quackBehavior
and there are two methods: performQuack() and performFly()
these instance variables hold a reference ro a specific behavior at runtime , for example "flyhigh" "nofly" or "loudQuack" etc..
but i think i am not implementing this correctly in the cpp code , please let me know what i am doing wrong and if i missed to provide any important info.
thank you for your time!