How to write Composition and Aggregation in java
- by Mifas
I want to know how to identify composition and aggregation code in java. I have C++ Code, But I don't understand how to write in java.
Composition
class A {};
class B { A composited_A; };
Aggregation via Pointer
class A {};
class B
{
A* pointer_to_A;
B(A anA){
pointer_to_A = &anA;
}
Can anyone please tell me how both are working in JAVA. (I know what is meant by Composition and aggregation )
};