Python Forum
programming of compositions (UML) example: forest
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
programming of compositions (UML) example: forest
#4
Yes just add a method to add items for example
class Tree:
 
    def __init__(self, branches=None):
        self.branches = branches or []
        
    def add_branch(self, branch):
        self.branches.append(branch)
Reply


Messages In This Thread
RE: programming of compositions (UML) example: forest - by Yoriz - Mar-24-2019, 10:26 PM

Forum Jump:

User Panel Messages

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