Python Forum
" Run constructors" instead of the correct line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
" Run constructors" instead of the correct line
#1
Hi,

I am trying to run this code. Somehow it shows " Run constructors" instead of the line " Hallo daar!". What am i doing wrong?

Any input is much appreciated!




class MyClass:
    Greeting = ""
    
    def __init__(self, Name="daar"):
        self.Greeting = Name + "!"
        
    def SayHello(self):
        print("Hallo {0}".format(self.Greeting))
>>> %Run constructors.py
Reply


Messages In This Thread
" Run constructors" instead of the correct line - by MaartenRo - Aug-28-2020, 06:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Do all class need constructors?(__init__) hsunteik 13 9,394 May-02-2017, 09:36 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020