I am trying a program with friend function(max) which is common to 2 classes(XYZ and ABC). Here though compilation doesn't show any error/warning, I can't see expected output on console. So I tried to display something just to see if it comes on screen. But strange enough, nothing comes up on the screen.
Can you please have a look at the code below? Am I missing something? (specially to include any required header file)
How do you run this program? Afaik, this program will not do anything by itself - it won't start terminal; you have to either use it from terminal, or have some IDE provide you with their terminal for program to work.
A shot in the dark: You are naming the program "test" when you build it. Unix/Linux already have a program named test, so you are running that program and not yours. Try giving the absolute path: $ ./test
Pro tip: If you aren't seeing "Test2" or "Test3" on console, you need to try this:
@LowestOne: It worked. I added void in int main() as suggested by you and it showed output. Also to add, now when I remove void again from int main() and recompile and run it, it still shows output :-)
Can you please explain the reason behind this behavior?