When do you prefer to use composition than aggregation?
Answer Posted / naveen sisupalan
Composition is a stronger form of aggregation. If you are
sure that the life of the part is managed entirely by the
whole then you can go for composition. Without whole, the
part can't exist also.
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
Give any criteria when you use an abstract class and an interface?
Is it possible to create partial structs, interfaces and methods?
Is @functionalinterface annotation mandatory to define a functional interface? What is the use of @functionalinterface annotation? Why do we need functional interfaces in java?
Explain about abstraction?
What are different ways to create string object?
What if we make the method as abstract in another interface?
What is meant by overloading functions and operators?
State some of the advantages of object oriented programming?
Is it possible to provide method implementations in java interfaces? If possible, how do we provide them?
What are abstract classes?
What is data encapsulation and what's its significance?
What is the benefit of using inheritance?
Define Data Abstraction. What is its importance?
Can a function be overloaded based on return types?
Can you instantiate an abstract class and what is an inner class?