This document discusses polymorphism through overloading the __pow__() method in a Square class. It instructs to create two Square objects, squareOne and squareTwo, and find the result of raising the side length of squareOne to the power of the side length of squareTwo. This is to return the first side length to the power of the second, such as if squareOne has sides of 2cm and squareTwo has sides of 4cm, it would return 16 by calculating 2**4.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
31 views1 page
Exercise Polymorphism
This document discusses polymorphism through overloading the __pow__() method in a Square class. It instructs to create two Square objects, squareOne and squareTwo, and find the result of raising the side length of squareOne to the power of the side length of squareTwo. This is to return the first side length to the power of the second, such as if squareOne has sides of 2cm and squareTwo has sides of 4cm, it would return 16 by calculating 2**4.