Accessing a Local variable

Hi,

I have always known and believed that a variable declared as local in a class can be accessed only within the class and not outside.
Also a variable declared as a static is shared with the class instances and no separate copy for instance is made…

But during a recent interview i had attended, the interviewer said a local variable can be accessed from a extended class by declaring it as both static and local in the base class… I am confused now…

Can i get a clear consensus on this please???

The qualifiers static and local are unrelated and you have the correct behavior.

I hope you don’t go to work there.

In reply to dave_59:

Thanks for the clarification and the suggestion as well…