Oct-15-2020, 03:12 PM
All,
Is this behavior correct for ABC class? I expected only the method in class S to be printed. Is this the correct behavior?
All the Best,
David
Is this behavior correct for ABC class? I expected only the method in class S to be printed. Is this the correct behavior?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import abc from abc import ABC, abstractmethod class R(ABC): def rk( self ): print ( "Abstract Base Class" ) class K(R): def rk( self ): super ().rk() print ( "subclass " ) class S(K): def rk( self ): super ().rk() print ( "Class S" ) # Driver code t = S() t.rk() ''' This prints Abstract Base Class subclass Class S ''' |
David