Save
CC3_Final_Term
OOP
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Isha
Visit profile
Cards (21)
Object-oriented technology
Models
real-world
objects
View source
Real-world objects
table
television
chair
View source
Software objects
Can represent
real-world
objects and other (living or non-living)
entities
View source
The Python programming language uses
objects
and
classes
in building programs
View source
Objects
State
Behavior
View source
Dog object
Name, color and breed (state)
Bark,
jump
,
roll-over
(behavior)
View source
Class
Objects with
similar
characteristics can fall under one
class
View source
Dog class
Bulldog
Poodle
Chihuahua
View source
Class
Template
or
blueprint
from which objects are derived
View source
Class
Attributes
(state/variables)
Methods
(behavior)
View source
Defining a class
Class
Classname
: statements...
View source
Class members
Fields
(
attributes
)
Methods
(
behavior
)
View source
Class instantiation
Creating an object
out
of a class
View source
__
init
__
function
Automatically called when creating a new object, allows class to initialize object
attributes
View source
The
self parameter
is a reference to the current instance of the class, and is used to access
variables
that belong to the class
View source
__ indicates a
private
variable in Python
View source
Class variables are declared at the
class
level,
instance
variables are declared in the __init__ method
View source
Inheritance is a mechanism that allows a class to inherit
properties
and
behaviours
from another class
View source
Inheritance
Derived class (subclass/child class)
inherits
from
base
class (superclass/parent class)
View source
Method
overriding
Subclass
provides specific implementation of a method already provided by
superclass
View source
The version of a method that is executed is determined by the
object
used to invoke it, not the
reference variable type
View source