note 92637 modified in language.oop5.abstract by danbrown

From: Date: Mon, 03 Aug 2009 16:58:56 +0000
Subject: note 92637 modified in language.oop5.abstract by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159047@lists.php.net to get a copy of this message
The person - student - employee is the classic example where the interfaces are more appropriate. It is true that students, and employees are persons, but a person can be both a student, and an employee. <?php class Person { // Properties for Person objects. } interface IStudent { // ... } interface IEmployee { // ... } class Student implements IStudent extends Person { // ... } class StudentEmployee implements IStudent, IEmployee extends Person { // ... } ?> --was-- The person - student - employee is the classic example where the interfaces are more appropriate. It is true that students, and employees are persons, but a person can be both a student, and an employee. <?php class Person { // Properties for Person objects. } interface IStudent { // ... } interface IEmployee { // ... } class Student implements IStudent extends Person { // ... } class StudentEmployee implements IStudent, IEmployee extends Person { // ... } http://php.net/manual/en/language.oop5.abstract.php

« previous php.notes (#159047) next »