Wednesday, 15 September 2010

How to specify class attribute type in PHP? -


I want to create an attribute friend type array and an attribute /

And my properties can not be of another type, but my specialty friend can be redundant!

You can specify method arguments, but not .

Consider creating fields private and define gates / sets:

  private $ friends; // There is no possibility to define the type of personal $ skill; Public Function setFriends (array $ friends = zero) {$ this-> Friends = $ friends; } Public Function Setcill (skill $ skill) {$ this- & gt; Skill = $ skill; }  

No comments:

Post a Comment