Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Unique Object | Classes and Objects
Object-Oriented Programming in Python
course content

Course Content

Object-Oriented Programming in Python

Object-Oriented Programming in Python

Unique Object

Code

Methods inside the class:

  • say_meow;
  • set_name with the name argument .

set_name defines an additional attribute name and sets the value of the given statement. self means that this variable is the class attribute, not the local variable.

Object cat is created. We call say_meow method and change the attribute of the class by referring to cat.hair_color. We set 'Princess' as the name using set_name method.

Everything was clear?

Section 1. Chapter 4
We're sorry to hear that something went wrong. What happened?
some-alt