What is difference between aggregation and inheritance?
Anonymous
Aggregation: Has-A relationship. We compose a new class(class A) with a component of aggregated class(Class B( inside it . so A -->Has A --> B Inheritance: Is A relationship: We inherit some or all the properties of Parent class (Class A) to the child class (Class B). So, B -->Is a --> A Example: Class A { int meth(){ } } class B extend A{ /*A objA = new A(); objA.meth();*/ int meth(){ syso(B); } }
Check out your Company Bowl for anonymous work chats.