This link has been bookmarked by 8 people . It was first bookmarked on 25 Sep 2006, by Ben Dembroski.
-
Alex MadayWhat is self - a good intro to classes in python.
-
These collections of objects with identical
characteristics are collectively known as a class. -
Every method
definition in a class in Python starts with a parameter called
self. The actual name self is just a
convention, but like many programming conventions consistency
is good so let's stick with it! (As you'll see later JavaScript
has a similar concept but uses the name this instead.)
-
-
Elijah Lofgren"The InterestAccount class
Now we use inheritance to provide an account that adds interest (we'll assume 3%) on every deposit. It will be identical to the standard BankAccount class except for the deposit method. So we simply override that: "
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.