1

I have a class Player and a class Place

public class Player{
  String name;
  int hp;
  Place place;

  public Player(int health){
    this.hp = health;
  }

  public void setPlace(Place p){
    this.place = p;
  }
}

I can only see examples about the composition in that way : in the constructor : this.place = new Place();

but what about the code above? is it aggregation or composition?

daer
  • 25
  • 7

0 Answers0