Created
June 30, 2011 03:49
-
-
Save andrusha/1055593 to your computer and use it in GitHub Desktop.
inheritance example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: class Ellipse(object): | |
...: def setSize(self, x, y): | |
...: pass | |
...: | |
...: | |
In [2]: class Circle(Ellipse): | |
...: def setSize(self, x): | |
...: pass | |
...: | |
...: | |
In [3]: Ellipse().setSize(1,2) | |
In [4]: Circle().setSize(1) | |
In [5]: Circle().setSize(1,2) | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
/<ipython console> in <module>() | |
TypeError: setSize() takes exactly 2 arguments (3 given) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment