#22 Super keyword in Python | Python tutorial Series in Tamil | EMC Academy

preview_player
Показать описание
The super keyword in Python is a powerful tool used in object-oriented programming to refer to the superclass or parent class of a derived or subclass. It allows you to access and invoke methods and attributes defined in the superclass from within the subclass.

By using super, you can effectively override or extend methods inherited from the superclass while still retaining their original functionality. It provides a way to maintain the existing behavior of the superclass while adding or modifying specific functionality in the subclass.

The syntax for using super is as follows: super().method_name(arguments). This invokes the method method_name from the superclass, allowing you to perform actions defined in the superclass before or after adding your own modifications in the subclass.

The super keyword is particularly useful in scenarios where you want to augment the behavior of a method rather than completely replace it. It helps maintain code consistency and prevents duplication by leveraging the existing implementation in the superclass.

Additionally, super can be used to access superclass attributes or variables. This enables you to reuse and modify values defined in the superclass without having to redefine them in the subclass.

Overall, the super keyword in Python serves as a valuable mechanism for achieving method overriding, extending functionality, and maintaining code reuse and consistency in object-oriented programming.
Рекомендации по теме
Комментарии
Автор

Enaku intha Python video la romba use ha iruku na.. Nan ipathan 3 rd video vanthuruken.. Ana patha varaikum nallavae purithu na. Unga video mulama nan IT company la epdi job panrathu la yosichi vachiruken na .. Oru idea ha vae illama iruntha na bsc cs course choose panna mothu unga video patha aprama than namba python la concentrate pannaum nu thonichii na.. Namba thanks na

aneesfarira
Автор

Excellent presentation, Great wishes, Thanks a lot for sharing this.

balrajswamy
Автор

Hi na
Thx for ur effort

Na ipa 06 video vanthruklam
Rmba clear purithu

Views kammi ya poguthu nu stop Mattum pannidathinga
Kind request

Kamesh_
Автор

Hi Bro, Thank you for providing python modules. It is very useful for me to learn the python from the scratch. Can you please help me with the File handling, CSV file handling, exceptional handling and other modules like OS module, SYS module and PANDAS

sureshkrishna
Автор

Hi bro, in the last section of the video la you haven't inherited the properties of class A to class B, yet neenga super keyword use paneenga to call the constructor of class A. How come 'A' constructor print aachu even without being inherited by B?

aswinkumar
Автор

Bro super❤ and uploading in angular series

masteredin
Автор

Ethachu practice pandra mari ithuku munnadi potta example question mari python Oops concept ku question pottu vedio potingana konjam use full ha irukum bro

DarkDemon-vg
Автор

Bro ML & DS basics podu bro... Pls...

saidhinakars
Автор

c class kula verum b mattum call panaka en bro a print aaga maatingdhu adha b la super key word kuduthirkom la

balaroxx
Автор

Sir oops concepts la abstraction mattum update pannuga pls

sriharinaathan
Автор

Super () __init__()
Ithula init eppothu automatic kathana work agu but namaya intha __init__() ta function mari call pandro intha time la init constructor ra illa function na bro ? Class object kuda easy bro but inheritance and superkeyword purijalu konjam confusion aguthu

Goldencupid
Автор

nama first yantha class ah call panurom enpathu mukyam illa, athu first yantha constuctor erukuthoo athu thaa first print agum

singaraveland
Автор

If I add (b, a) in class c with super component i get abc, but if I add only b, it prints only c and b.. can you check ur video once pls.

datachat
Автор

class a:
def __init__(self):
print("a")
def display(self):
print("you are in class a")
class b(a): # class a is inherit with b class
def __init__(self):
super().__init__()#to use things in the parent class
print("b")
def display(self):
print("you are in class b")

class c(a, b):#multiple inhertitance
def __init__(self):
super().__init__()
print("c")
def display(self):
print("you are in class c")
obj1=c()
Running this code thrown me below error
TypeError Traceback (most recent call last)
Cell In[13], line 13
10 def display(self):
11 print("you are in class b")
---> 13 class c(a, b):#multiple inhertitance
14 def __init__(self):
15 super().__init__()

TypeError: Cannot create a consistent method resolution
order (MRO) for bases a, b

ilakiyasivakumar
Автор

Data structures and algorithm ku video potunka bro❤

abarnasri
Автор

apo multiple inheritance podave use ila thana ..? a, b potalum namauku thriyum a matumthan call aagum b call aaguthu nu... anyone explain for this qn?

mkhvdo
Автор

bro neenga oru small mistake panerkenga

singaraveland
welcome to shbcf.ru