Wie greife ich von einer übergeordneten Klasse in Python auf ein Attribut aus?Python

Python-Programme
Anonymous
 Wie greife ich von einer übergeordneten Klasse in Python auf ein Attribut aus?

Post by Anonymous »

Das funktioniert nicht: < /p>

Code: Select all

class parent:
a=1
class child:
b=a+1
< /code>
Auch < /p>
class parent:
a=1
class child:
b=parent.a+1
< /code>
Auch < /p>
class parent:
a=1
class child:
b=self.a+1
< /code>
Auch < /p>
class parent:
a=1
class child:
b=super().a+1
Was mache ich?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post