Let's take a look at the extraction first so we have this abstract glass of the store and it has only
a single method for getting the color of the particular item that is being sold on the store.
And we also have two objects that are currently sold.
So we have a purse and we have a bag.
Both of them have the same type of constructor.
It accepts a color parameter.
It will add this color parameter to their private member variables.
And also they have the implementation for the get color method.
So as you can see here, we do a out mentioning the color of the of the particular item and also we
return the color.
On the other hand, we have the color interface, an empty interface in our case just for simplicity.
And we have two colors defined here.
We have red, which will define only the two string method.
So in our case, we want to output the name of the class because this is the name of the color.
And also the same thing goes for blue as well.
So we have the app class that will execute our code.
So basically we created here two bags, one red and one blue.
And you can see here we supply a new color as well.
And two persons, one red and one blue.
So basically all to get color methods should output the name of the color of of each item that is being
sold.
So let's run this.
So as you can see, this is doing the right thing, so instead of having separate classes for red bag,
for blue bag, you just have a single class that extends an abstract class in our case to store class.
And it accepts as a parameter the the color of of the of each particular item.
So it reduces very much the need for creating extra classes.
It reduces the size of the code.
And also it's it's very easy to read when you have such a structure.
That's it for this tutorial.
Join me in the next video where we are going to discuss about the filter pattern.