RE: What is the practical use of "abstract" and "interface"?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
...stuff...
[/snip]

The practical use of an abstract class is in its ability to define
criteria for classes that inherit from it. How practical would it be to
define a 'truck' class with 4 wheels and then define a 'car' class with
4 wheels when we could define an abstract class that defines vehicles
with 4 wheels? Both of our classes can now inherit from that abstract
class and we can define features only relevant to them. If you refactor
diligently you will no doubt find places where you need to create
abstract classes.

The methods that are exposed by an object define the interface for that
object. It is how everything outside of the object interacts with the
object. You don't have to know how the method works all you need is the
interface....like the gas pedal on the car. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux