Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 793 Bytes

File metadata and controls

28 lines (19 loc) · 793 Bytes

Module 052: Class Methods, Static Methods, Properties

  • Phase: 6. Advanced OOP & Errors
  • Duration: 2 hours

Learning Objectives

  • Use @classmethod for alternative constructors
  • Use @staticmethod for utility functions inside a class
  • Implement computed attributes with @property
  • Apply getter, setter, and deleter patterns
  • Understand why @property is superior to manual getters/setters

Topics Covered

  • @classmethod: method bound to the class, cls parameter
  • Alternative constructors via class methods
  • @staticmethod: method without self or cls
  • @property: computed attributes, getter/setter/deleter
  • Property-based validation and encapsulation

Prerequisites

Module 051: Composition vs Inheritance

Next Module

Module 053: Dataclasses