posted 24 years ago
Hi Dheeraj,
Lets step through the program starting a foo.main:
1. Create new Extension for logo method parameter
2. Extension constructor: compiler automatically places call to
base constructor as first line.
3. Base constructor (i = 0) calls add method with param = 1
4. Extension add method: i += 2 --> i = 2
5. Extension constructor calls add method with param = 2
6. Extension add method: i += 4 --> i = 6
7. Logo method calls add method with param = 8
8. Extension add method: i += 16 --> i = 22
9. Logo method calls print method
10. Base print method: prints out "22".
Regards,
Manfred.