Lecture6_DynamicLanguage
Lecture6_DynamicLanguage
Lecture 6
Mohamed Mead
What is an Object?
• A software item that contains variables and methods
– Polymorphism:
the ability to overload standard operators so that they have
appropriate behavior based on their context
– Inheritance:
the ability to create subclasses that contain specializations of their
parents
OOP, Defining a Class
• Declaring a class:
class name:
statements
– Example:
class Point:
x = 0
y = 0
# main
p1 = Point()
p1.x = 2
p1.y = -5
Classes
Classes describe data and provide methods to manipulate
that data