Object Oriented Programming Terminology
Object Oriented Programming Terminology
in
y.
IN
ud
st
PYTHON
ty
si
er
iv
un
un
iv
er
si
ty
st
ud
y.
in
• Instead of starting from scratch, you can
in
create a class by deriving it from a preexisting
y.
class by listing the parent class in parentheses
ud
after the new class name.
st
ty
• The child class inherits the attributes of its
si
parent class, and you can use those attributes
er
iv
as if they were defined in the child class. A
un
un
iv
er
si
ty
st
ud
y.
in
un
iv
er
si
ty
st
ud
y.
in
un
iv
er
si
ty
st
ud
y.
in
Overriding Methods
in
methods. One reason for overriding parent's
y.
ud
methods is because you may want special or
st
different functionality in your subclass.
ty
si
er
iv
un
un
iv
er
si
ty
st
ud
Example
y.
in
Base Overloading Methods
in
y.
ud
st
ty
si
er
iv
un
Overloading Operators
in
represent two-dimensional vectors, what
y.
ud
happens when you use the plus operator to
st
add them? Most likely Python will yell at you.
ty
• You could, however, define
er
si
the __add__ method in your class to perform
iv
un
y.
in
Data Hiding
in
visible outside the class definition. You need
y.
ud
to name attributes with a double underscore
st
prefix, and those attributes then are not be
ty
directly visible to outsiders.
si
er
iv
un
un
iv
er
si
ty
st
ud
y.
in
un
iv
er
si
ty
st
ud
y.
in