Kursinnhold
Object-Oriented Programming in Python
Object-Oriented Programming in Python
1. Classes and Objects
2. Encapsulation
3. Inheritance
4. Polymorphism
Challenge
Oppgave
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.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 2
Challenge
Oppgave
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.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 2