• Kurse
  • Code Compiler
  • Diskutieren
  • Preise
  • Teams
Menu
0

Accessing parent classes function inside a child class

class Parent: def __init__(self): def func(): print('hello') class Child(Parent): def __init__(self): # is it possible to call the func function here?

pythonclasses
6th Dec 2018, 11:11 AM
Juho Pesonen
Juho Pesonen - avatar
1 Antwort
+ 8
Use super https://www.pythonforbeginners.com/super/working-JUMP_LINK__&&__python__&&__JUMP_LINK-super-function
6th Dec 2018, 12:28 PM
Rstar
Rstar - avatar

Häufig solche Fragen?

Effizienter lernen, kostenlos:

  • Einführung in Python

    7.1M Lernende

  • Einführung in Java

    4.7M Lernende

  • Einführung in C

    1.5M Lernende

  • Einführung in HTML

    7.5M Lernende

Alle Kurse anzeigen
Heute heiß
Is this realistic enough?
1 Votes
"Which is harder to master — Machine Learning or Cybersecurity? And why?"
1 Votes
Need friends
0 Votes
"What’s the best way to combine creativity and coding? Can storytelling improve web apps?"
1 Votes
I am a beginner, please teach me how to use Python
0 Votes
MASS N NUMBER OF OBJECT DELETION FROM A CLASS
0 Votes
Web Development
0 Votes
Can u learn multiple language at the same time, without misplacing the formats of each with the other
0 Votes
Please complete this code.
0 Votes
Python
1 Votes