0

Why we use s3=student(m1,m2) ?

Hi guys can you please tell me y we use s3 =student(m1,m2) in add method. I am getting confused https://code.sololearn.com/cuFUV5hpGph3/?ref=app

13th Feb 2021, 10:47 AM
P.B.V.Lalith Kumar
P.B.V.Lalith Kumar - avatar
2 Respostas
+ 4
When you do "s3=s1+s2" __add__ method is called where s3=student(m1, m3) instantiates new object s3 of class student with values m1 and m3 and returns the newly created object. i can't answer "Why" though but i told you what is going on. Maybe that's what the program was supposed to do ?
13th Feb 2021, 10:53 AM
Abhay
Abhay - avatar
+ 1
Thank you
13th Feb 2021, 1:15 PM
P.B.V.Lalith Kumar
P.B.V.Lalith Kumar - avatar