Simple Question
Posted: Sat Mar 22, 2008 10:52 pm
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;
?>