News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pixelstech.com:
Should we use Abstract class or Interface?
April 18, 2013 @ 09:22:23

On the Pixelstech.com site today there's a new post that talks about the differences between abstract classes and interfaces and when's the best time to use either (or both).

When we write programs, we may often get into a situation where we don't know whether we should use Abstract class or Interface when we want to define an abstract object. These two are very similar and they are interchangeable. On Stackoverflow, this question is asked many times, it's related to many programming languages. Also in the official documentation of PHP regarding the Abstract class and Interface, people are arguing about this. To understand this question, we need to understand their differences and use scenarios.

They provide examples of abstract class and interface usage with one of the main differences being that you can define functionality in abstract classes. There's also examples showing classes that extend the abstract class while implementing the interface at the same time, helping to define the object structure to an even finer level.

0 comments voice your opinion now!
abstract class interface tutorial choice extends implements

Link: http://www.pixelstech.net/article/1366044255_Should_we_use_Abstract_class_or_Interface_

blog comments powered by Disqus

Similar Posts

Michael Girouard's Blog: Rolling Your Own MVC: The View

Alan Knowles' Blog: Getting Started with HTML_FlexyFramework, DataObjects and HTML_Template_Flexy

SitePoint PHP Blog: Getting Started with Symfony2 Route Annotations

Pavel Shevaev's Blog: Make php-fpm execute arbitrary PHP scripts via socket

DevShed: Working with the Active Record Class in Code Igniter


Community Events

Don't see your event here?
Let us know!


community series release performance interview symfony2 api introduction opinion laravel conference library framework podcast php7 application example extension version voicesoftheelephpant

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework