abstract class animal {
function bark(){
// bark here
}
// bark here
}
}
class dog extends animal{}
class cat extends animal{}
$dog = new dog();
$dog->bark();
$dog = new dog();
$dog->bark();
Maybe one day our cat had a bark about it, or maybe we've coded an if statement to do something different like return false if it's a cat.
abstract class animal {}
class dog extends animal {
function bark(){
// bark here
}
}
class cat extends animal {}
$dog = new dog();
$dog->bark();
No comments:
Post a Comment