when we declare function1 in function2 then other function(other than function2) are not allowed to call function1. but when we overload function1 then we can call it anywhere (in any function) why?
1
Expert's answer
2014-02-06T12:14:29-0500
Dear Gaurav, There is a concept of "scope" in the programming. When you declare function2 inside of function1 like this function1 { function2 {
} } it can be accessed from function1 only as it was declared in its scope. If you want to use function2 in other functions you will have to declare it in the global scope, like this: function1 { } function2 { } I this case function1 and function2 can be accessed from any other function.
Comments
Leave a comment