So in the last video, we looked at the object class and there we saw these very special comments.
And I think they are so cool that I wanted to show you how you can use them for yourself.
So the triple slash here is a special comment.
And it is used for, in this case, a very cool little thing that we're going to use it for ourselves.
So what I will do is I have this person class and inside of the person class, let's go ahead and create
a method that will increment the age.
So let's say it will return the age and it will age someone.
So get or become older where we are passing the years so int years and then what we will return is age
plus years.
Okay.
So whatever the age of a person is, we're going to increment it by whatever we pass on to this method
become older.
So now I'm like pasting the code from here, this summary and this param and returns.
Now you can obviously type it out manually yourself.
This is what it looks like.
And I'm going to now create my own summary and where it will all of this stuff be displayed.
Well let me show you.
Once you hover over this two string you see that it says returns a string that represents the current
object, and then it says what?
It returns a string that represents the current object.
Well, that's cool and all, but now let's use it for our own liking or for our own stuff.
So instead of saying determines whether the specified object is equal to the current object, we're
going to say makes our object older.
And then the parameter that we want to have in the description of for our id.
So this is only for our ID as a developer.
Right.
So the parameter or the yeah, the parameter that I want to use here is years.
I'm going to say that this is the parameter that holds the amount of years the object should age.
And then we have this returns here.
And we're not returning a boolean.
So we cannot return true.
If so and so or false if so and so.
But what we're going to just say is returns the new age after aging or slash becoming older.
Okay.
So now let's use this method.
Let's call the become older method onto our coral okay.
So we have coral.
He's 30 or 45 years old.
So now we are going to call this method become older.
And then we're just going to pass in five.
So now coral should be 50 years old.
So let's go ahead and use coral dot display person info.
And let's actually hover over become older.
And you can see makes our object older.
And it returns the new age after age aging slash becoming older.
So now I just also realized that our method is not really making our person older, but it is currently
doing not much.
It's really just returning whatever this new age is.
So instead of returning age plus years, let's just return the new age after changing the age.
And now let's display the person info and we will see that our coral is now 50.
So what we have here are XML comments, right?
And they are only there for us as developers to make our life easier when working with our code and
with for other developers as well.
So what we can now see is we can see makes our object older, and the return statement okay returns
so and so.
And now this param that we created allows us to hover over this parameter here.
And it says the parameter that indicates the amount of years the object should age.
And that's our statement that we put here okay.
So that's pretty much what we can do with it.
And it's pretty cool.
So now obviously you can add that to all of your methods and make them a lot easier to read, make them
understandable and so forth.
Really powerful tool.
Highly recommended.
As I said, it's called XML comments or the XML documentation that you create using these comments.
Cool.
So that's it for this video.
See you in the next one.