1. Home
  2. Docs
  3. OOP
  4. super()কীওয়ার্ড

super()কীওয়ার্ড

মনেকরি আমাদের দুইটি ক্লাস আছে একটি Vehicle আরেকটি ক্লাস আছে Car নামে যা Vehicle ক্লাসকে ইনহেরিটেন্স করে এখন আমরা যদি Vehicle এর প্রপার্টি বা মেথডকে Car ক্লাসে এক্সেস নিতে চাই তাহলে super() এর পরে ডট চিহ্ন ব্যাবহার করে এক্সেস নিতে পারবো

class Vichlee:
    brand= 'Toyota'

class Car(Vichlee):
    
    def get_brand(self):
     print(super().brand)
    
car = Car()
car.get_brand()
#====== Output =====
Toyota

এক্ষেত্রে Car ক্লাসে Vehicle এর প্রপার্টি brand এক্সেস নিতে super().brand করা হয়েছে

How can we help?