 So now that we're starting to build with objects we're able to do something called association and we get two new terms composition and Aggregation so let's look at say that homework assignment that we had last week. We designed a Pokemon class Now Pokemon by itself is alright. They're wild and everything, but it was a single object What happens if I start to want to flesh that out? I want to make Pokemon red or blue or fuchsia, whatever the colors are nowadays Well, let's think about this for a second. We have a main character We have what's known as a trainer and any one trainer any one trainer can own One to six Pokemon one to six Pokemon Because that trainer is owning a specific Pokemon, you know two people can't own the same Pikachu or Bulbasaur or whatever This is known as composition one object owns Six Pokemon one object owns another object or owns instances of another object Well, then we've got aggregation if we think about Pokemon again Pokemon have a large Set of moves the game has a large set of moves that all kind of have their own little tweaks and nuances to them, you know electroshock is a thunder type it has a base power of I don't know 30 and You know it does have a few different things But any kind of Pokemon can have that any kind of Pokemon can have that For example Pikachu could have it or Raichu or a Zappados or some other electric type You can have this electroshock move. This is where aggregation comes into play is that any one Pokemon can have a move have one to four moves, but it doesn't necessarily own that move So let's start to flush that out. Let's think about object or our move object again Just so we can kind of see that a little in action. What's this one mean? What does this? slide kind of give us Well, it's okay if we look at it for a second if we review back We look at sort of our context clues this filled in triangle right here. This is telling me that I have an composition I have a single object owning instances of another object Then we've got the empty Diamond this one is saying that I have one object aggregating another object Having a relationship between an object, but not necessarily owning it In this case if we look at it any one person can have a relationship that we call supervisor With another person so we could have inside of the person class Say another person Supervisor Equals new Person that's all that kind of means so we just have inside of a person class another person now Okay, so let's get back to Pokemon for a second. Let's think about that that Pikachu here's Pikachu Pikachu is a Pokemon. It's in Electric type it has a name called Pikachu Electric type, you know it HP is 10 or 12 or whatever, you know, we have this Well, we also say that this Pikachu has four moves because again Anyone Pokemon can have one two four moves one to four moves So we say that Pikachu has quick attack slam Electro ball and thunder smash All right pretty Simplistic what's going on there? Well, if we think again how we looked at the homework assignment in the past Here's a little abbreviated version of that what we did was we made an array of strings We made an array of strings for the attacks known the moves Pikachu knows So this was just a string This was just a string. It's just a string. This was just a string And then when we had some objects like add move and remove move We just said that those were going to accept a string parameter again So how can we flesh this out? Well, what happens if instead of move? Just being some string array. What if we turned it into its own Object we went out and we made a move of that Java file Well, what we can do is we can expand on that. So suddenly I go and I make that move Dot Java File and I still have Pokemon and I'm not going to try and do the little Checkmark on my put Pokemon just in case, you know, the computer I'm using is not You know savvy to the times and it can't handle Unicode characters But you can see that suddenly I have one class. I Have Pokemon inside of its class. I have attacks known and inside there I say it has an array of move objects. Yes, what I create new moves I create move Electro ball or you know move M1 equals new move and Then inside there, you know, I skipped over putting the constructor in here just to save up on space But I could have its name so slam. I Could have its attack power. So, you know 30 I can have it's a type as well electric electric Rick there we are I can do that with every single one of Pico choose moves And so now I have a little bit more control So when I look at something like my damage formula, I can get the base attack. I can get this attack power For any given move and so suddenly we have you know, say this one is 30 quick attack It's quick, but it's not really powerful. So it only does about 15 damage Electro ball that all right electro ball will say that that's about 30 as well. It's an electric style. This is a physical style physical Electric and then you know, we got that thunder smash while that sounds very powerful And so uses up a lot of Pikachu's energy, but it does 75 damage. Oh, that's a very powerful move So this is how we can start to have an association with our classes