SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 42 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"


You can always check if a class is derived from another class by using the
instanceof operator.
Interface
Interface is an empty class which contains only the declaration of methods. So any
class which implements this interface must contain the declared functions in it. So,
interface is nothing but a strict ruling, which helps to extend any class and strictly
implement all methods defined in interface. A class can use any interface by using
the implements keyword. Please note that in interface you can only declare
methods, but you cannot write their body. That means the body of all methods
must remain blank.
So why is an interface necessary, you might ask? One of the reasons is it implies
strict rules while creating a class. For example, we know that we need to create some
driver classes in our application, which can handle DB operations. For MySQL, there
will be one class, for PostgreSQL there will be another, For SQLite, another one and
so forth. Now your developer team has three developers, who will separately create
these three classes.
Now how will it be if each of them implements their own style in their own classes?
The developers who are going to use those driver classes will have to check how
they define their methods and following that, the way they have to write their code,
which is too boring and hard to maintain.


Pages:
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6