C++ - Why can't you define a function inside another function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

C++ - Why can't you define a function inside another function?

Quite curious a limit, I believe it hides something deep in the Language....

7th Sep 2019, 3:24 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
2 Answers
+ 5
Short answer: it won't achieve much more than what the language already offers.
9th Sep 2019, 5:48 AM
Sonic
Sonic - avatar
+ 3
I don't know why, but i do know that if it could be done, then things would be more complex. So i think we are ok with what we have already.
16th Sep 2019, 12:26 AM
Black Winter