Exemplo n.º 1
0
    def getProgrammerObject(self, progName):
        prog = self.searchProgrammer(progName)

        #no existing programmer found with this name, create one
        if (not isinstance(prog, Programmer.Programmer)):

            prog = Programmer.Programmer(progName, self.programmerIterator)
            #this iterator will also be the node number
            self.programmerIterator = self.programmerIterator + 1
            #add it to the general overview list
            self.listOfProgrammers.append(prog)

        return prog
Exemplo n.º 2
0
Arquivo: Main.py Projeto: l2sega/OOP
# 4_encapsulation

from Person import*
from Programmer import*
from House import*

person = Person("John", 23)
sub_person = Programmer("Mike", 34)

person._test_protected_method()
person._Person__test_private_method()

sub_person._test_protected_method()
sub_person._Person__test_private_method()

person.test_public_method()



Exemplo n.º 3
0
Arquivo: Main.py Projeto: l2sega/OOP
# 3_Inheritance

from Person import* 
from House import*
from Programmer import*

person1 = Programmer("John", 23)
person2 = Person("Mike", 34)

house1 = House("1street")

house1.settle_person(person1)
house1.settle_person(person2)

person1.description_of_person() 
person2.description_of_person()

house1.description_of_house()