OOP Newbie question as I convert a crufty program to OOP

Class Person sets up various properties of a person. Classes B, C, and D extend A in various ways for different roles people do.

What I ran into last night was trying to use a function outside of the classes to instantiate objects. For example:

Function Z instantiates 3 objects of class B, one each object of class C.

Function Y instantiates one instance of class D and then runs Function Z 3 times, for a total of 16 objects.

Function X creates one object of Class D and then calls Function 7 3 times.

What I don't know, and couldn't clearly explain on ##php last night, is how to have Functions X, Y, and Z be able to create objects from classes B, C, and D.

Any help, or good pointers to tutorials? Should I even be using functions? The goal is to create groups of objects based off group membership guidelines.

If you're well and truly bored, the full code is at:

https://github.com/LeamHall/LHTraveller_Mercenary_Generator

Thanks!

Leam
_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/show-participation

Reply via email to