Wednesday, February 27, 2008

PHP 5 Touching OOP

i read and i read and im confuse. ok next chapter.

PHP5 OO Language

wow now im actually learn Object Oriented thingy.

class Person
Method :
setName($name)
getName()

Properties :
$name

and this is the code :

class Person {
private $name;

function setName($name) {
$this->name = $name;
}

function getName() {

}
};

$judy = new Person();
$judy->setName("Judy");

$joe = new Person();
$joe->setName("Joe");

print $judy->getName() . "\n" ;
print $joe->getName() . "\n" ;

itll print the name.

No comments: