None
<!doctype HTML>
<head>
<title> OOP </title>
<!-- THIS IS A COMMENT, it won't show up anywhere except the source -->
</head>
<body>
<pre>
<?php
ini_set('display_errors', 1);
class being {
protected $heroname;
protected $realname;
public function setHeroname($theheroname) {
$this->heroname = "$theheroname";
}
public function setRealname($therealname) {
$this->realname = "$therealname";
}
// public function getHeroname() {
// return $this->heroname;
// }
public function heroGreets(){
echo "<h1> GREETINGS CITIZENS !!! I AM $this->heroname </h1>";
}
// public function saymyrealname(){
// some sort of disclaimer code, perhaps a password
// echo "<h2> DON'T TELL ANYONE, but I'm really....$this->realname</h2>";
// }
}
$cap = new being();
$cap->setHeroname("Captain America");
$cap->setRealname("Steve Rogers");
$cap->heroGreets();
//echo "Haha, I am evil, and I have discovered that the hero's secret identity is" . $cap->realname;
$cap->saymyrealname();
?>
</body>
</html>
Backlinks: FSU Courses:LIS5367:The Cronut Assignment