How to use Super in python 3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use Super in python 3

29th May 2018, 9:52 AM
Pradeep
Pradeep - avatar
2 Answers
+ 1
Super is function.this is used in oop programming.suppose you have a parent class and you want to use in base class by using inheritance.when we use parent class in base class you can tell the python by using super function which attribute you want to override of parent class in base class.e.g= class Car(): def__init__(self,name,speed,acc) self.name=name self.speed=speed self.acc=acc class Newcar(Car): def__init__(self,name,speed,acc,price): super().__init__(name,speed)->Now super override the attribute of Car class in Newcar class. self.price=(price)
29th May 2018, 4:37 PM
Maninder $ingh
Maninder $ingh - avatar