Topics: Crash Course

Day 10: Understanding Classes – Crash Course on Programming

Last updated on December 23rd, 2025

{{brizy_dc_image_alt entityId=

You will learn...

  • The definition of a class
  • The relationships between a class and an object
  • How to define a class
  • How to create an object (instance)
  • Methods and attributes
  • Setters and getters
  • The advantages of setters and getters

Author

Shogo

「一人ひとりにあった学習」をモットーに、オンラインチューター・家庭教師を行っています。定期試験から受験指導、インターナショナルスクールに通う方の学習指導など幅広く対応。プログラミングを介した簡単なデータ分析の学習サポートも行っています。

教員免許(数学1種、理科1種・専修)、修士(理学)。

個人塾運営やオンライン教育系プラットフォームでの講師、学習塾講師の経験を通じて、生徒一人ひとりに合わせた丁寧な指導と自ら考える力を育むサポートを行ってきました。


Video Summary

Object-oriented programming represents real-world entities as objects with data and functions, enhancing code organization and reusability. "Python" language, as an object-oriented language, utilizes classes as blueprints for creating these objects. This video introduces the concepts of classes and objects, clarifying that a class serves as a template while an object is an instance of that class. An analogy is provided: a blank student information sheet represents a class, and the completed sheets represent objects. The syntax for defining a class in "Python" programming involves the 'class' keyword, followed by the class name.

Attributes are variables within a class, while methods are functions in a class. Instance attributes are unique to each instance, while class attributes are shared. In the example, object_type is a class attribute representing a common feature of circles, while center and radius are instance attributes specific to each circle. The self keyword indicates instance attributes.

Methods, which are functions in a class, include the __init__() method, crucial for initializing instance attributes when creating a new instance. The __init__() method requires self as the first parameter to reference the instance.

Understanding classes is fundamental in programming, and further learning resources are available in the article.

この続きはcodocで購読