Amazon Interview Question
Software Engineer / DevelopersOO feature: abstraction, inheritance, encapsulation, polymophism.
There are two kind of polymophism
one is run-time by override, in java all the function is virtual, it could be override by subclass method with same signature(same name, return value, parameter type, number).
the other is compile time by overload. in the class with same function name, but could have different number of parameters eg: Vector add(E o) and add(int index, E element) also operator overloading eg: double + double ,int+int.
Inheritance is to conceal the detail implementation of class to others. only exposes certain interface. It could avoid other program depending on the part of implementation likely to be changed in future.
can someone tell me how polymorphism and virtual functions are resolved?
- dbfroggy September 08, 2008