Is void a datatype? Trick question.
In C#, the following is syntactically correct:
void f(){}
void g() { return f(); }
In C++ and Java, it's an error - a void function should not return a value.
I'm sure a proper language lawyer would be able to expound for a while on the implications of this, and justify why this is theoretically correct either way...
No comments:
Post a Comment