As I wrote in my post, I would expect that the compiler notify me (by error or warning) about the problem. My point (question) is: why is the compiler able to notify me about the problem if both 'Func1' are outside the Test2 class or if I move the code from Do2 function to the main.