Member Avatar for soUPERMan

I have this code:

class Member:

    def __init__(self, name, typeOM, fee, yearJoin):

        self.name = name
        self.typeOM = typeOM
        self.fee = float(fee)
        self.yearJoin = yearJoin
   
    # Reader Methods
    def getName(self):
        return self.name

    def getTypeOM(self):
        return self.typeOM

    def getFee(self):
        return self.fee

    def getYearJoin(self):
        return self.yearJoin

    def getMemberTypeString(self):
        if self.typeOM == 'P' or self.typeOM == 'p':
            return "Playing"
        else:
            return "Social"

    
    # Writter Methods

    def setName(self, nameIn):
        self.name = nameIn

    def setTypeOM(self, typeOMIn):
        self.typeOM = typeOMIn

    def setYearJoin(self, yearJoinIn):
        self.yearJoin = yearJoinIn

    
    # toString method

    def __str__(self):
        return "%s (%s  member) joined in %i" \
               %(self.name, str(self.getMemberTypeString), self.yearJoin)

The getMemberTypeString method is supposed to determine from the typeOM the type of member then print the appropriate string, but i keep getting a memory address reference(at least thats what i think it is), what am i doing wrong??

Here's what i get:

Mark (<bound method Member.getMemberTypeString of <__main__.Member instance at 0xb662044c>>  member) joined in 1989

In line 46, you're not actually calling the method. Try self.getMemberTypeString() in line 46 instead of self.getMemberTypeString.

Member Avatar for soUPERMan

Thanks, that solved it...how come the other methods like self.name work without the empty brackets?? Thanks again for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.