I have seen somewhere the use of the following syntax:
class MyClass : AnotherClass
What does this mean? Is this inheritance without the use of MyClass(AnotherClass):?
I have seen somewhere the use of the following syntax:
class MyClass : AnotherClass
What does this mean? Is this inheritance without the use of MyClass(AnotherClass):?
After the colon i.e. the Class
definition comes the building element of the Class
:
class ClassName: <statement-1> . . . <statement-N>
So AnotherClass
means nothing here itself and does nothing with inheritances.
The syntax:
class MyClass : AnotherClass
is the same like:
class MyClass:
AnotherClass
It could be an instantiation in the form:
a = AnotherClass()