Why to say, my function is of IFly type rather than saying it's Airplane type
- by Vishwas Gagrani
Say, I have two classes:
Airplane and Bird, both of them fly. Both implement the interface IFly. IFly declares a function StartFlying(). Thus both Airplane and Bird have to define the function, and use it as per their requirement.
Now when I make a manual for class reference, what should I write for the function StartFlying?
1) StartFlying is a function of type IFly .
2) StartFlying is a function of type Airplane
3) StartFlying is a function of type Bird.
My opinion is 2 and 3 are more informative. But what i see is that class references use the 1st one. They say what interface the function is declared in. Problem is, I really don't get any usable information from knowing StartFlying is IFly type. However, knowing that StartFlying is a function inside Airplane and Bird, is more informative, as I can decide which instance (Airplane or Bird ) to use.
Any lights on this: how saying StartFlying is a function of type IFly, can help a programmer understanding how to use the function?