G
Gunnar G
What is the difference between the two lines in the main function?
class MyClass{ ....};
int main(){
MyClass a();
MyClass a;
}
class MyClass{ ....};
int main(){
MyClass a();
MyClass a;
}
Gunnar G said:What is the difference between the two lines in the main function?
class MyClass{ ....};
int main(){
MyClass a();
MyClass a;
}
Look it up. It's in section 10 of the FAQ:
http://www.parashift.com/c++-faq-lite/
(Hint: what does "int foo();" mean to you?)
verec said:I for one, would have gladly traded that "C compatibility" quirk,
and happily lived in a world where C++ would have disallowed function
delclarations _within_ function definitions ...
Stroustrup once wrote that "C arrays are broken beyond repair", and
I'm quite close to think the same holds for C++ ... beyond repair.
Not to say that C++ is useless, or whatever, just unncessarily
inconsistent, as soon as you start looking at the details.
I wish Stroustrup had come up with: "--C" instead
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.