YUNOVA · Python programming

Module 12: Object-Oriented Python

Notes for offline study · 30 November 2026

Python me class aur object

Key points

  • Class एक साँचा है और object उससे बनी असली चीज़।
  • पहले class लिखी जाती है, फिर उससे object बनाया जाता है।
  • एक ही class से कितने भी object बन सकते हैं, हर एक का अपना data।

Python me __init__ constructor aur self

Key points

  • यह वह function है जो object बनते ही अपने आप चलता है।
  • self उसी object की तरफ़ इशारा करता है जिस पर काम हो रहा है।
  • self के साथ नाम लिखकर value object के अंदर रख दी जाती है।

Python me inheritance

Key points

  • Inheritance में एक class दूसरी class की सब चीज़ें पा जाती है।
  • Bracket में parent class का नाम लिखने पर सब कुछ मिल जाता है।
  • इससे एक ही code बार-बार लिखने की ज़रूरत नहीं पड़ती।

Python me method overriding aur super()

Key points

  • Child class में वही नाम का function दोबारा लिखना overriding है।
  • अब object पर child वाला function चलेगा, parent वाला नहीं।
  • super() से parent वाला function भी अंदर से बुलाया जा सकता है।

Python me encapsulation aur private variable

Key points

  • Encapsulation का मतलब है data को class के अंदर सुरक्षित रखना।
  • नाम से पहले दो underscore लगाने पर वह बाहर से सीधे नहीं मिलता।
  • बदलने के लिए class के अपने function बनाए जाते हैं।

Free on YUNOVA · yunova.in · Sign in to add your own lesson notes to this sheet.