Composite design pattern = polymorphism?
-
I’m studying computer programming, and I’m a little puzzled by the Composite design pattern. In "Design Patterns in C#" by Steven John Metsker, Addison-Wesley, it says: COMPOSITE lets clients treat individual objects and compositions of objects uniformly. And in "Programming C#", O'Reilly, it says about polymorphism: Thus, polymorphism refers to being able to use many forms of a type without regards to the details. Is this not one and the same thing?
Programming is like Mathematics… you take ONE step at the time! ;-)
-
I’m studying computer programming, and I’m a little puzzled by the Composite design pattern. In "Design Patterns in C#" by Steven John Metsker, Addison-Wesley, it says: COMPOSITE lets clients treat individual objects and compositions of objects uniformly. And in "Programming C#", O'Reilly, it says about polymorphism: Thus, polymorphism refers to being able to use many forms of a type without regards to the details. Is this not one and the same thing?
Programming is like Mathematics… you take ONE step at the time! ;-)
You already posted the question elsewhere. As before, they are definitively differnt concepts (Polymorphism is a pillar of OOP, Composite is a design pattern, i.e. a very good solution of a well known design problem). As before, I suggest you to deep study your OOP books instead of blindly extrapolate sentences from. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
You already posted the question elsewhere. As before, they are definitively differnt concepts (Polymorphism is a pillar of OOP, Composite is a design pattern, i.e. a very good solution of a well known design problem). As before, I suggest you to deep study your OOP books instead of blindly extrapolate sentences from. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
Yes, I know, sorry....accurately I posted this one first, but in wrong forum... I probably asked the question wrong... I know the difference between design patterns and polymorphism... I read the text about Composite, and began thinking about polymorphism. But thanks for the answer.
Programming is like Mathematics… you take ONE step at the time! ;-)