Learn
Learn Python: Classes
Instantiation

A class doesn’t accomplish anything simply by being defined. A class must be instantiated. In other words, we must create an instance of the class, in order to breathe life into the schematic.

Instantiating a class looks a lot like calling a function. We would be able to create an instance of our defined CoolClass as follows:

cool_instance = CoolClass()

Above, we created an object by adding parentheses to the name of the class. We then assigned that new instance to the variable cool_instance for safe-keeping so we can access our instance of CoolClass at a later time.

Instructions

1.

In script.py we see our Facade class from last exercise. Make a Facade instance and save it to the variable facade_1.

Folder Icon

Sign up to start coding

Already have an account?