Below is a numbered code snippet, which will answer both the upper questions. Let us understand in detail the numbered sections.
- 1 and 2 -- This defines the interface definition.
Function.abstractMethod () defines a method as abstract.
- 3 - We need to register the interface, which is done by using register Interface method.
- 4, 5 and 6 - Inheritance and Interface is defined when we register the class. Register Class has three inputs. 4th section defines the main class, which needs to be registered. 5th section defines the parent class from which it will inherit. 6th section defines the interface. So
clsMyCustomCustomer is the class which derives from
clsCustomer and implements I Customer interface.
Figure 18.6:- Inheritance and Interfaces in action
Asked In: Many Interviews |