Advertisement
ujiajah1

putting-it-all-together-part-2.php

Aug 20th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.       <title> Practice makes perfect! </title>
  5.       <link type='text/css' rel='stylesheet' href='style.css'/>
  6.     </head>
  7.     <body>
  8.       <p>
  9.         <!-- Your code here -->
  10.  <?php
  11.        class Dog
  12.        {
  13.        public $numLegs = 4;
  14.        public $age;
  15.        public function __construct($name)
  16.        {
  17.        $this->name = $name;
  18.     }
  19.        public function bark()
  20.        {
  21.        return "Woof, ";
  22.     }
  23.        public function greet()
  24.        {
  25.           return "Hello I'm ". $this->name . " nice to meet you!";
  26.     }
  27.     }
  28.        $dog1 = new Dog("Barker");
  29.        $dog2 = new Dog("Amigo");
  30.           echo $dog1->bark();
  31.           echo $dog2->greet();
  32.     ?>
  33.       </p>
  34.     </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement