Kurssisisältö
Object-Oriented Programming in Python
Object-Oriented Programming in Python
1. Classes and Objects
2. Encapsulation
3. Inheritance
4. Polymorphism
Challenge
Tehtävä
Swipe to start coding
- Create the
Cat
class:
- Set
info
andmake_sound
methods inside theCat
class; - Inside the
make_sound
method print'Meow'
.
- Create the
Dog
class:
- Set
info
andmake_sound
methods inside theDog
class; - Inside the
make_sound
method print'Bark'
.
- Create
cat
anddog
objects based on theCat
andDog
classes respectively.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 4. Luku 2
Challenge
Tehtävä
Swipe to start coding
- Create the
Cat
class:
- Set
info
andmake_sound
methods inside theCat
class; - Inside the
make_sound
method print'Meow'
.
- Create the
Dog
class:
- Set
info
andmake_sound
methods inside theDog
class; - Inside the
make_sound
method print'Bark'
.
- Create
cat
anddog
objects based on theCat
andDog
classes respectively.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 4. Luku 2