#56 Python Tutorial for Beginners | Constructor in Inheritance

แชร์
ฝัง

ความคิดเห็น • 267

  • @abhishekanand2782
    @abhishekanand2782 5 ปีที่แล้ว +172

    OMG, This course is far better than other paid course. I may sound like an agent of Telusko or Naveen, but the course is designed specifically as per the need of the users. Most of the time we come across the videos where the contents are limited by the knowledge of the presenter or speaker and even the speaking ability of the teacher determines the quality of a course. But this playlist on python is amazing. Complete package. Naveen not only having the enormous amount of knowledge but also his speaking and verbal ability is of sky high level. Thanks a lot. Ahhhh, Forgot 1 thiing, The way the deliver the final word "BYE" in the Shahrukh style. Its cherry on the cake.

  • @nilkanthchakar3824
    @nilkanthchakar3824 4 ปีที่แล้ว +9

    I was actually worst at coding. But after reaching till this point of this playlist I've already surpassed many of my classmates. After telling them I have learned this for free, they were shocked and even they have started learning from your course. Thank you

  • @bishwajit667
    @bishwajit667 6 ปีที่แล้ว +17

    sir, your way of teaching is really too good. its interactive and interesting, i never get bored in between . thanks for such good content. :)

  • @vishwanathghanekar1606
    @vishwanathghanekar1606 3 ปีที่แล้ว +2

    Your energy in voice never let's me zone out of the session, you're amazing! thanks

  • @piotrlobacz
    @piotrlobacz 4 ปีที่แล้ว +1

    This is excellent. Focuses on subject only and explains it in the easiest way possible without throwing any unnecessary garbage in. Thanks you Sir!

  • @blood1612
    @blood1612 4 ปีที่แล้ว +9

    You made my lockdown productive thankyou

  • @biggy9564
    @biggy9564 4 ปีที่แล้ว +7

    One of the amazing courses wich I have ever seen !

  • @nishantm1924
    @nishantm1924 3 ปีที่แล้ว

    This is the best best online course I have found till date. Best teacher Everrrrrrr

  • @swetajoshi6557
    @swetajoshi6557 3 ปีที่แล้ว +1

    You had made most of the concepts super duper easy to learn. Really Thank you . Videos are really helpful. I love your way of teaching. God bless you.

  • @prakashsaran-xv3sk
    @prakashsaran-xv3sk 4 หลายเดือนก่อน

    Thank you for free course
    I’m continuing watching your course series
    It’s very helpful
    I have decide
    I’ll never purchase online course
    As long as teacher like you are teaching for free
    Thank you sir 🙏🙏🙏

  • @jonathanreznik6062
    @jonathanreznik6062 3 ปีที่แล้ว

    english is my 3rd language so it's a bit harder for me to understand, but this guy explains it so good that im not having a hard time trying to understand what he says. what im trying to say is that i like this chanel and its better than payed courses.

  • @ejm209
    @ejm209 4 ปีที่แล้ว +2

    Navin man you are the best in the game no doubt... Thank you man

  • @zakiasmaa6834
    @zakiasmaa6834 2 หลายเดือนก่อน

    Sir Thank you so much for all your efforts, it's the first time that I find a great techaer like you, thank you a lot

  • @amrutashinde5971
    @amrutashinde5971 3 ปีที่แล้ว +1

    Sir your teaching is just awesome

  • @Chandalyt
    @Chandalyt 4 ปีที่แล้ว +1

    This concept became clear very easily

  • @shivendrarajawat9517
    @shivendrarajawat9517 4 ปีที่แล้ว

    I have changed my google search on python to like multithreading in python telusko ... Ha ha I now add telusko in every python topic search ... Great lectures

  • @naveenarikela7330
    @naveenarikela7330 4 ปีที่แล้ว +11

    Twinkle twinkle little star 🌟 Navin sir python star 🌟

    • @rajns8643
      @rajns8643 3 ปีที่แล้ว

      Boht Hard

  • @techshower7520
    @techshower7520 4 ปีที่แล้ว

    (Siddesh) : Thanks Navin. Very infomative and rightly aligned flow.

  • @parthpatel313
    @parthpatel313 4 ปีที่แล้ว +1

    Crystal Clear Explanation Sir !!
    Thanks

  • @ajpsv
    @ajpsv 4 ปีที่แล้ว

    Created account just to comment. Simple and to the point explanation.

  • @pavanjain2178
    @pavanjain2178 6 ปีที่แล้ว +2

    Enjoying this series very much 😊😊😊

  • @OASEBAK
    @OASEBAK 4 ปีที่แล้ว

    The best teacher I ever seen

  • @poojakh7051
    @poojakh7051 ปีที่แล้ว

    Thank you for this. I am back here after so many days just to say thanks... So I had learnt python from this playlist in lockdown, and I am so grateful that I did it. I must say this has helped a lot. Lots of thanks for such videos ☺

  • @tagaram6548
    @tagaram6548 3 ปีที่แล้ว +1

    Thank you very much , I am not able to understand this concept properly you help me made it. But I will also prefer to read python documentation to understand concept more properly after videos😊👌

  • @davidkik
    @davidkik 2 ปีที่แล้ว

    Best explanation ever spotted on python object oriented programming. 🙌 great job!! Keep posting

  • @darthvader4310
    @darthvader4310 4 ปีที่แล้ว

    I had already watched other python tutorial but this guy he nails the knowlede in your brain also he teaches deep concepts

    • @rajns8643
      @rajns8643 3 ปีที่แล้ว

      Lol , so this is what u do when u ain't beating ur enemies

    • @darthvader4310
      @darthvader4310 3 ปีที่แล้ว

      @@rajns8643 what

  • @tesfalemhaile8427
    @tesfalemhaile8427 5 ปีที่แล้ว +1

    Thank u man i'm enjoying it. This tutorial is far better than other paid course👍waiting more videos of python

  • @sankarsan
    @sankarsan 5 ปีที่แล้ว +2

    Keep up the good work Navin. God bless you.

  • @shreya8975
    @shreya8975 ปีที่แล้ว

    Am just loving your channel ❤️

  • @vantastic
    @vantastic 3 ปีที่แล้ว +2

    Great video. I have a question though... when you say MRO is left to right, is this because the call to Class(A,B) reads A first (as it is on left)... if we swap them around to Class(B,A) will it pick B first? Or is there some other abstract thing at play here... order of top to bottom? What if we swapped Class A and Class B around, so Class B was at the top?

  • @adil07869
    @adil07869 4 ปีที่แล้ว

    Sir thanks a lot because you have provided a very useful and free of cost course which helped us to get our goals. Even this course is better than other paid courses. You helped us to save our future, You are a "Super Hero" sir. May God Bless You.

  • @TheKrishnaCookingVlogs
    @TheKrishnaCookingVlogs 3 ปีที่แล้ว

    If Possible, Please conduct live session on python programming in this weekend Naveen sir.
    It will very helpful to revise what we're learn.
    Really, enjoy the session, clearly understand inheritance concepts -> single-level, multi-level & Multiple Inheritance
    super() method usage, __init__ constructor and Method Resolution Order in inheritance.
    Best python teacher ever in my life.
    anyone want to do python crash course with-in 1 month, it is very helpful.
    I have storage testing background, this course very helpfully for my career. All of my colleagues are fan of you sir.

  • @bijenadhikari
    @bijenadhikari 4 ปีที่แล้ว +1

    wow. course is awesome.... (LOVE FROM NEPAL)

  • @abhinavpathak9211
    @abhinavpathak9211 4 ปีที่แล้ว +2

    You are so good thanks for making python simpler : )

  • @mohsinnajam7151
    @mohsinnajam7151 4 ปีที่แล้ว

    Excellent way of teaching. Thank you!

  • @adityaprakhar8878
    @adityaprakhar8878 6 ปีที่แล้ว

    loved the music in the beginning.....i think you should make the video with the music slightly playing in low volume in the background...will make it more interesting....one thing is that it might distract people from paying attention on what you are speaking....but i've seen videos in which they narrate with music in the background and it works.

  • @surajkottayi2451
    @surajkottayi2451 3 ปีที่แล้ว

    Navin, u r just amazing. Am really motivated to learn n teach like you. 👍😊

  • @Skaxarrat
    @Skaxarrat 6 ปีที่แล้ว +1

    Another great video. May I suggest a new idea for future videos? A series of videos (or a longer one) building something small (maybe using TkInter, plotly, etc)

  • @sudhirs003
    @sudhirs003 3 ปีที่แล้ว

    Excellent explanation. Due to MRO, this is printing init of Class A, how to print init of class B without changing (A, B) to (B, A) in Class C and do not want to print class A init. (pls note that, adding super in each class, print init in for all classes, I am looking to print for Class B only)

  • @pratikrout1400
    @pratikrout1400 4 ปีที่แล้ว

    Thanks sir you are a very great teacher

  • @AnkurSingh-uo4vo
    @AnkurSingh-uo4vo 5 ปีที่แล้ว

    Sir this is the best explanation for inheritence

  • @SERGIO-6
    @SERGIO-6 2 ปีที่แล้ว

    It's very nice vedio.
    you are are saying that in multiple inheritance it follows the left to right order.In c(A,B) if we want to call any method from c in b then how to call.

  • @subhamthemusicalguy8851
    @subhamthemusicalguy8851 2 ปีที่แล้ว

    Awesome way of teaching

  • @najimali32
    @najimali32 4 ปีที่แล้ว +1

    How to call class B __init__ from C class object if C is multiple inheritance i.e C(A,B): ??

  • @MisterTonton1
    @MisterTonton1 3 ปีที่แล้ว

    Almost perfect. One question is left over: How can use access methods of B from class C(A, B) !!! I really insist on that question, because it will ruin all the reasoning behind the multiple inheritance...

  • @balubalaji6324
    @balubalaji6324 5 ปีที่แล้ว +3

    Sir, Is there any way to involve constructor of class b in class c when class is involved in multiple inheritance of parent class a,b???

  • @ujjayhirbhagat5489
    @ujjayhirbhagat5489 3 ปีที่แล้ว +1

    instead of defining class C(A,B) you call as class C(B,A) to get the init of class B

  • @syedatifshah8020
    @syedatifshah8020 2 ปีที่แล้ว

    Awesome, it was very interesting to understand and gain

  • @reshmagaikwad300
    @reshmagaikwad300 5 ปีที่แล้ว +1

    Hi Navin,
    I couldn't understand , even if we don't specify the constructor in B it will call default constructor of B if we define object B.
    But then ,why Object of B calls constructor of A if don't specify the constructor of B.
    Please reply.

  • @DS_AIML
    @DS_AIML 5 ปีที่แล้ว

    Navin,Thankyou so much for doing great job of providing very clear explanation of each topics in python tutorials.Eagerly waiting for Django contents.

  • @sameedahri3939
    @sameedahri3939 5 ปีที่แล้ว

    this video is full of concepts love it

  • @shubhamraja1345
    @shubhamraja1345 6 ปีที่แล้ว

    Two very very important question from this video...please answer this...I think it may be the question for majority of us
    1) why the object of bast class is not created by default or constructor is not called by default as in c++ or Java does??
    2) how to call constructor of all the base class in case of multiple inheritance?

  • @abhinavgulati1
    @abhinavgulati1 4 ปีที่แล้ว +1

    What if we want to access both left and right methods from class C itself ?

  • @jiteshbagul3632
    @jiteshbagul3632 4 ปีที่แล้ว +2

    Sir, what if in MRO we want class B init in calling class C???

  • @ujjawaljani7774
    @ujjawaljani7774 4 ปีที่แล้ว +5

    Sir, thanks for the lecture.
    But can u prepare lecture notes.
    We are ready to pay for that also.
    Plzz

    • @sohamn2823
      @sohamn2823 4 ปีที่แล้ว

      if u make of ur own u will understand more deeply

  • @0ans4ar-mu
    @0ans4ar-mu 2 ปีที่แล้ว

    In the case of duplicate methods between parent classes, using super() will not take any arguments to choose which to use, and will always go from left to right as you list them when defining the child class.
    ie. C(A, B) will pull from A in the case of duplicates, and C(B, A) will pull from B in the case of duplicates.
    In the case of duplicate methods between parent classes, you can choose which of the parent classes to use a method from by explicitly calling the method within the child class. Instead of using super().method() you can decide which instance of the duplicate to use by naming it explicitly. If your class inherits A before B, like in C(A, B), but you want to use a method from B that also exists in A, use B.method() to use it.
    super(). looks like a good shortcut for when you know you will not be dealing with choosing between duplicates, and you don't want to explicitly mention which class to call from.

  • @ajeettharu1785
    @ajeettharu1785 4 ปีที่แล้ว

    Lots of respect ,#Navin sir ...

  • @lalitshirsath4892
    @lalitshirsath4892 4 ปีที่แล้ว +1

    Sir,I am studying in first year engineering and i have learned 70% python and also did your lectures and i have to do project of iot which require kivy library to make app and i should learn it and i also want to prepare for college placement which requires c or jawa
    So,how can i plan for programming for 4 years of engineering? And should i start with c or not?

    • @likhithdasari7794
      @likhithdasari7794 3 ปีที่แล้ว

      learning python without c ....is ok.. you can ....but c is the basics of every language ..it gives you primary idea about coding so learn c first then try to learn C++ because you will cover max oops concepts there then go on to java .....after that pick up one language either c++ java or python and do practicng coding on codechef...so you will increase your coding skills day by day...

  • @debashishsaha2141
    @debashishsaha2141 4 ปีที่แล้ว

    Hi Navin,
    Regarding what you explained at 8:04
    Hi Navin, I have a question. Imagine I have two classes, A and B. In class A, I have class variable and class method. Now I want to access class variable and method from class A inside one of the the instance methods of class B. To access class method, I found that (after inheritance), I can access via using self. or A. or super().
    Is there any advised way to choose among those three options?

  • @anindian4601
    @anindian4601 3 ปีที่แล้ว

    Brother Navin I think your this video is INCOMPLETE, Bcos in Multiple Inheritance how to get Class B __Init__ you did not show

  • @srisrycomputer
    @srisrycomputer 5 ปีที่แล้ว +10

    Can u tell me how to fetch the values from right super class

    • @faran_siddiqui-d3t
      @faran_siddiqui-d3t 4 ปีที่แล้ว +14

      when class C(A,B) it will always fetch the values of A ie left to right even though you call super().__init__() multiple times.
      for accessing the values of B you should write C(B,A) then it will fetch the values of B. Thats the rule of MRO...

    • @sam-ho4yf
      @sam-ho4yf 4 ปีที่แล้ว

      @@faran_siddiqui-d3t what if i want to get both ?

    • @shubangimahajan4852
      @shubangimahajan4852 4 ปีที่แล้ว

      You can write B().___init___

    • @nirajdeshmukh7514
      @nirajdeshmukh7514 4 ปีที่แล้ว

      @@sam-ho4yf Same situation..

  • @anusharacharla9392
    @anusharacharla9392 3 ปีที่แล้ว

    As you told if we have multiple inheritance,it starts from left then,what if we want to access right method?

  • @yateeshky6514
    @yateeshky6514 4 ปีที่แล้ว

    Great one, it also covers some disputed concepts of system verilog too....😄😄

  • @merowe123
    @merowe123 4 ปีที่แล้ว

    Hello Navin instead of super().__init__() , we can you A(). any difference??

  • @mr_afzy
    @mr_afzy 5 ปีที่แล้ว +3

    you can access class B constructor...in this code
    super(A, self).__init__()
    NB:-i don't know the working methodology of this code. But this code is working ..

    • @vinaytigadi7991
      @vinaytigadi7991 5 ปีที่แล้ว

      it is not working if i do super().__init__() and super(B,self).__init().

    • @Indian-fh8hf
      @Indian-fh8hf 5 ปีที่แล้ว

      class GrandparentClass:
      def __init__(self):
      print ("init of GrandparentClass")
      def Feature1(self):
      print (" Feature 1")
      class ParentClass:
      def __init__(self):
      print ("init of ParentClass")
      def Feature1(self):
      print (" Feature 2")
      class SubClass(GrandparentClass,ParentClass):
      def __init__(self):
      super().__init__()
      print ("init of SubClass")
      def Feature1(self):
      print (" Feature 3")
      sub=SubClass()
      This Code Works fine for any Python 3 Editor. Avoid using Python2

  • @aniketbhalla1521
    @aniketbhalla1521 5 ปีที่แล้ว +1

    Please make a separate video on "MRO" of python

  • @ankammaraochintala2509
    @ankammaraochintala2509 3 ปีที่แล้ว +1

    Thank you for your spoon feeding sir

  • @harishbabu1920
    @harishbabu1920 3 ปีที่แล้ว

    thanks a lot sir !!!! This is Superb and amazing

  • @tsa_vibes
    @tsa_vibes 3 ปีที่แล้ว

    very well explained. thank you !

  • @abhijitmali6837
    @abhijitmali6837 2 ปีที่แล้ว

    U are amazing sir thank you for this

  • @srikantkonduri1264
    @srikantkonduri1264 4 ปีที่แล้ว

    If class C inherits both A and B ,
    Can I call both constructors simultaneously by some other means?
    Like passing Class name in super method?

  • @bhargavdas5146
    @bhargavdas5146 5 ปีที่แล้ว

    Class C(A,B)--- Prints only the __init__ method from Superclass Class A, but ClassC(B,A) prints the _init_ method from both Superclasses A and B. Explain please.

  • @chayan_ghosh
    @chayan_ghosh 4 ปีที่แล้ว +1

    Can the instance variables of superclass be inherited from superclass to subclass using an object of subclass?

  • @indreeshpandey343
    @indreeshpandey343 4 ปีที่แล้ว

    sir please up a series of python for intermediates so that it can help us in college, and making projects.

  • @vijaysingh-qn9hj
    @vijaysingh-qn9hj 4 ปีที่แล้ว

    What is the difference between super(B, self).__init__() and super().__init__() both are giving the same result

  • @ishuchauhan7138
    @ishuchauhan7138 4 ปีที่แล้ว +1

    In multiple inheritance what if we want to call method of B without calling A ...MRO says that A will be called first

    • @ishuchauhan7138
      @ishuchauhan7138 4 ปีที่แล้ว

      B.__init__(self) or class C(B,A)

  • @Ashokkumarg8
    @Ashokkumarg8 5 ปีที่แล้ว

    Class A = Have the defined constructor
    Class B = does not have any defined constructor
    When a = B(), on the video you told it would access the Class A Constructor only and Class B does not have any defined Constructor.
    My question, in Class B, by default there would be an empty constructor like below,
    def __init__(self):
    pass
    So, it would look for B class __init__ right?
    OR
    is this going to B class __init__ pass the B constructor and move to A?

  • @khyatisoni4852
    @khyatisoni4852 4 ปีที่แล้ว +1

    in MRO concept, what if we want to call init method of class B at same time. how to do it ? please can u teach us sir?

  • @ponbalajis9240
    @ponbalajis9240 3 ปีที่แล้ว

    We can use sub.__init__method(): in inheritance like super.__init__method()

  • @Rangarang
    @Rangarang 2 ปีที่แล้ว

    you are the besttttttttttt dear sir

  • @bhartikashyap5800
    @bhartikashyap5800 4 ปีที่แล้ว +2

    Sir when I was doing this programme output is not coming ..It is written that " Cannot create a consistence method resolution order for base A And B" ...Help me plzzz

    • @shillpichaudhary
      @shillpichaudhary 4 ปีที่แล้ว +1

      You must be inheriting the class A into the class B , while using the Multiple Inheritance level
      like this :
      class A:
      def me(self):
      print("Feature 1")
      class B(A):
      //like this : Inheriting the class A
      def me(self):
      print("Feature 2")
      class C(A,B):
      def me(self):
      print("Feature 3")
      c1 = C()
      c1.me()
      ____________In order to resolve the MRO error , you can try this (below):______________
      class A:
      def me(self):
      print("Feature 1")
      class B:

      def me(self):
      print("Feature 2")
      class C(A,B):
      def me(self):
      print("Feature 3")
      c1 = C()
      c1.me()

    • @siddheshpatil557
      @siddheshpatil557 4 ปีที่แล้ว

      @@shillpichaudhary Faced the same problem of MRO consistency. Thanks for resolving the error.

  • @yash-vh9tk
    @yash-vh9tk 4 ปีที่แล้ว

    simply superb

  • @juhiaggarwal908
    @juhiaggarwal908 5 ปีที่แล้ว

    Left to right depends on how you write , is there any specific convention how we do it?

  • @MohitKumar-kh6mv
    @MohitKumar-kh6mv 3 ปีที่แล้ว +1

    Awesome Awesome Awesome

  • @jax911123
    @jax911123 4 ปีที่แล้ว

    Hello Navin, can we explain or have another video showing how to efficiently use left n right class ?

  • @Rajadahana
    @Rajadahana 2 ปีที่แล้ว

    When considering MRO, does it consider the name of the class? Does it sort according to the alphabetical order to find what is the first on the left?

  • @riteshmahajan2302
    @riteshmahajan2302 5 ปีที่แล้ว +1

    class A:
    def __init__(self):
    print("init A")
    def feature_1(self):
    print("i am a feature 1")
    def feature_2(self):
    print("i am a feature 2")
    class B:
    def __init__(self):
    print("init B")
    super().__init__()
    def feature_3(self):
    print("i am a feature 3")
    def feature_4(self):
    print("i am a feature 4")
    class C(B, A):
    def __init__(self):
    print("init c")
    super().__init__()
    def feature(self):
    super().feature_1()
    c_obj = C()
    In above code C is inherit from B and A and I have created object of class C which call __init__ method of C and super().__init__ method of C class is calling __init__ of B method(Absolutely fine as per MRO) and I have not inherit B class from A class but super().__init__ method of B class is calling __init__ method of A class. Can alnybody please explain how it is possible without inheriting the class from another class it is calling the constructor of that class.
    Belwow is the output for your reference
    init c
    init B
    init A

    • @sagarrao79
      @sagarrao79 5 ปีที่แล้ว

      let me if you got the answer ?

    • @jonsnow1762
      @jonsnow1762 5 ปีที่แล้ว

      if you write "class C(B):" only then it is not calling __init__ of A.
      It means first it called __init__ of B then A.
      if you cut "super().__init__()" from B and paste it in A and you inherit "class C(A, B):" like this then the output is:-
      init c
      init A
      init B

  • @BrighterWay
    @BrighterWay 5 ปีที่แล้ว

    Absolutely fantastic.

  • @thimothy2461
    @thimothy2461 3 ปีที่แล้ว

    How many types are there in inheritance sir ? because just now i found Hybrid Inheritance and Hierarchical Inheritance .

  • @dwaraknatekarp
    @dwaraknatekarp 4 ปีที่แล้ว

    Bro, ur the Best !!👍👍

  • @arorayash905
    @arorayash905 4 ปีที่แล้ว

    I have a doubt.
    What if we create one function in Class A and one function in Class B but with the same name.
    now i inherit Class A in Class B and after creating an object for class B and want want to call that function but from class A.
    For Example----
    class A:
    def F1(self):
    print("I am Function 1 from Class A")
    class B(A):
    def F1(self):
    print("I am Function 1 from Class B")
    b = B()
    b.F1()
    Output will be "I am Function 1 from Class B".
    but i want to call function F1 from Class A.

  • @surajkottayi2451
    @surajkottayi2451 3 ปีที่แล้ว

    Navin, could u pls explain how to call B's constructor here or any method in class B.

  • @hrravihosur
    @hrravihosur 2 ปีที่แล้ว

    Hello Navin sir, as mentioned 'C' class is inherited with class 'A' & 'B' then how to call class 'B's feature1() method from class 'C' object. By default, it is calling class 'A's feature1() method & found no option to call class 'B' feature1() method. I know, there will be way to call this method, could you please let me know how to do that. Thanks !!

  • @Shubham-fk4is
    @Shubham-fk4is 5 ปีที่แล้ว +1

    Please make videos on Django

  • @shyamnaidu2204
    @shyamnaidu2204 4 ปีที่แล้ว

    If we want call constructor of b using c's obj in multiple inheritance what is the condition we want apply?
    Is we call super()._init_() again?

  • @ROHIT-gv7xk
    @ROHIT-gv7xk 5 ปีที่แล้ว

    i buy udemy python course but after watching ur videos sir it is better than udemy.

  • @DevrajPM
    @DevrajPM ปีที่แล้ว

    iam become big fan sir

  • @thinkwith_shannu
    @thinkwith_shannu 5 ปีที่แล้ว

    Navin sir ki whistle podu....👌😍

  • @voalcalisticTanmay
    @voalcalisticTanmay 6 ปีที่แล้ว +3

    Referring to the example in the video,
    in case of multiple inheritance, What if I want to call both the left(A) and right(B) super classes constructor in the sub-class(C)'s constructor?
    How will I achieve it ?
    If you could help me out.
    Thank you in advance. :)

    • @sam-ho4yf
      @sam-ho4yf 4 ปีที่แล้ว

      so bro what the ans?

  • @thinkwith_shannu
    @thinkwith_shannu 5 ปีที่แล้ว

    Sir I tried one crazy thing. I defined two same methods and called them with object. Why it is printing the second method? Can u clarify my doubt sir,Please.
    class A:
    def __init__(self):
    print('This is A init')
    def feature1(self):
    print('this is feature 1')
    def feature1(self):
    print('this is feature 2')
    a1=A()
    a1.feature1()
    The result of above code is "this is feature 2". How it is calling?