Sharing interfaces using polymorphism


show more Sharing interfaces using polymorphism provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP show less
please wait ...

Sharing interfaces using polymorphism

When developing an application, I'm typically working with many different kinds of data in different structures, each with a different behavior and need. However, if I were to use different naming conventions for every single data structure, my application would descend into chaos! The phrase "Spaghetti code" is an apt description, meaning the source code is impossibly complex and tangled, like a pile of pasta. Sounds delicious, but it's difficult to organize. To avoid this mess, I can use an object interface. An interface specifies what methods a class must implement, but doesn't say how those methods should be implemented.

There are similarities to an abstract class, but the main importance is that interfaces don't have any methods of their own. In fact, an interface is not a class at all, but it's similar enough that auto loading will work with it. To use an interface, a class uses the keyword implements, followed by the name of the interface. A class can im...

Sharing interfaces using polymorphism
Video duration: 4m 39s 1h 57m Intermediate Updated Apr 10, 2013

Viewers:

Sharing interfaces using polymorphism provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP

Subject:
Developer
Software:
PHP
Author:
please wait ...