What is composition in c Explain the purpose of composition
What is composition in c#? Explain the purpose of composition. Example.
Solution
Composition denotes \"is-a-part-of\" relationship between objects.
purpose of composition in c#:
composition is about the essence of programming. Complex problems can be solved by decomposing them into many smaller problems that each can be worked out easily. Finally those small pieces have to be put together to form the overall solution. One way of combining these small pieces is function composition.
it can be implemented this way:
Example for composition:
The following example shows how the composition function can be used:
