Define and use constructor
|
<?php class book { private $title; private $isbn; private $copies;
public function __construct($isbn) { $this->setIsbn($isbn); $this->getTitle(); $this->getNumberCopies(); }
public function setIsbn($isbn) { $this->isbn = $isbn; }
public function getTitle() { $this->title = "title"; print "Title: " . $this->title . "<br />"; }
public function getNumberCopies() { $this->copies = "5"; print "Number copies available: " . $this->copies."<br />"; } }
$book = new book("1111");
?>
|
|
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
-
|