阅读背景:

polymorphic behaviour through composition in c++ without multilevel inheritance

来源:互联网 

I would like to achieve the polymorphic behavior through composition , instead of multilevel inheritance.in below example code bluerectangle is derived from rectangle and bluecircle is derived from circle. so the problem is I might have same depth in inheritance hierarchy so the job is to reduce the hierarchy level using composition instead of multilevel inheritance .can we achieve the polymorphic behavior here with composition, if yes then what design needs to be followed here. currently I just started reading design pattern so it seems to be similar to bridge pattern , but not able to proceed further without having proper pointers. I would like to achieve the polymorphic behavio




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: