Advertisement
bappy7706

Object Oriented PHP Part-3(Inheritence)

May 30th, 2020
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport"
  6.           content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8.     <title>Document</title>
  9. </head>
  10. <body>
  11. <h1 style="text-align: center;color: maroon;font-weight: bold; font-family: 'Mongolian Baiti'"> Object Oriented PHP Part-3(Inheritence)</h1>
  12. <br>
  13.  
  14. <?php
  15.  
  16. class ParentClass{
  17.  
  18.    public $fathername =" Abdur Rahim";
  19.    public $mothername ="Khursheda Parvin";
  20.  
  21.  
  22.    public function MainIn()
  23.    {
  24.  
  25.        return "Wellcome to Tanvir Hossen Bappys Family";
  26.  
  27.    }
  28.  
  29. }
  30.  
  31.  
  32.  
  33. class ChildClass extends ParentClass
  34. {
  35.  
  36.     public $sonname= "Tanvir Hossen Bappy";
  37.  
  38.  
  39. }
  40.  
  41. //echo (new ChildClass)->fathername;
  42.  
  43.  
  44. $object = new ChildClass;
  45.  
  46. echo $object->MainIn();
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. ?>
  54.  
  55.  
  56.  
  57. </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement