63 845
Assignments Done
99,2%
Successfully Done
In August 2018

Answer to Question #38717 in C++ for Gaurav shukla

Question #38717
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?
Expert's answer
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.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions