Loading...

oops in php

Overloading in php

  • Different meaning in other programming languages.
  • Better name:"dynamic properties"
  • How php handles calls to properties and methods which do not exist or not visible

Example:

<?php 
class Product{
}
$p= new product;
echo $p->name;//error:Notice:undefined property:product::$name

$p->name='Mobile';
echo $p->name;//Mobile
  • get value of undefined property:notice
  • set value of undefined property:define and set
  • ​​​​​​​private properties may seem to be visible in sub classes