Another similar question:
When calling a method (from separate class) that returns a value which is derived from another class (from within the separate class). Do we need to instantiate the variables of derived class in that calling method?
Another similar question: When calling a method (from separate class) that returns a value
Share
If you are calling a method in another class, the variables already are instantiated. In order to call said method, you must have either a) constructed a new object i.e
or b) the method is static, which means it is instantiated already and you can call it as
in either case, the variables used by the class are instantiated upon construction, and those used locally by the function are allocated once the function is called.