How to write Composition and Aggregation in java
Posted
by
Mifas
on Stack Overflow
See other posts from Stack Overflow
or by Mifas
Published on 2012-03-25T17:21:50Z
Indexed on
2012/03/25
17:29 UTC
Read the original article
Hit count: 388
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 ) };
© Stack Overflow or respective owner