Help Accessing an Extended Class Function - PHP OOP

beggeng

New Member
How can I access an extended Class function from an already created object?(A) - This works, by not creating an object:\[code\]$UserType = 'User_Vote';$vote = User::getVote($UserType)->getVoteQuery();\[/code\](B) - Trying the same idea from an already created object (this is what I want to do) returns the error: unexpected T_PAAMAYIM_NEKUDOTAYIM (unexpected '::')\[code\]$UserType = 'User_Vote';$object = new User();$vote = $object::getVote($UserType)->getVoteQuery();\[/code\](C) - But this works:\[code\]$UserType = 'User_Vote';$object = new User();$objectUserType = $object->getVote($UserType);$finalObject = $objectUserType->getVoteQuery();\[/code\]Why doesn't block (B) above with the double '::' work? It seems identical to block (A) except that the object is already created. Do I have to call each function separately as in block (C) to get around this?
 
Back
Top