Object-Oriented Programming in Python
Constructor is a unique method that is automatically called during object creation. This method is not obligatory to define. The object can be created with the constructor generated automatically, as we did before.
Constructor has reserved name
After the object is created, it contains
hair_color attributes, that are created during the constructor call.
If we don't input any values of
hair_color, these attributes automatically have default values:
Test the code below!
Everything was clear?