Page 1 of 1

Simple Question

Posted: Sat Mar 22, 2008 10:52 pm
by zachsilvey
I need a little help, I'm just learning the ways of object oriented programming. Can anyone tell me why won't this display "Bob".

Code: Select all

<?php
class Person{
    var $name = "Zach";
    function getName(){
        return $this->name;
    }
    function setName($newName){
        $this->name = $newName;
    }
}
$object = new Person;
$object->setName("Bob");
echo $object->getName;
?>

Re: Simple Question

Posted: Sat Mar 22, 2008 11:02 pm
by zachsilvey
nevermind if forgot the () on the final getName function