|
features post Articles
(Articles)
online chat server:
irc.xor.cx
channel:
#neworderrandom article
quotable quotes Please do not shoot the pianist. He is doing his best. Oscar Wilde
|
What Wrong With This Code? [C++]
@ What's Wrong With This Code
May 09 2005, 22:56 (UTC+0) | THA writes: What happens when a language encounters ambiguity involving new language features that might be mistaken for old language declarations? Quite recently, I encountered this similiar piece of code that someone was having problems with:
class Test { public: Test(int y) {} };
int main() { int x; Test(x); }
This code actually exibits a rather subtle error involving declarations with the C++ language. The coder wanted to test the constructor, except the compiler keeps generating an error. Identify the problem (why the compiler error) and offer a solution. Be as specific and as descriptive as possible with your solutions and explanations. Resources: GotW #1 Solution |
| Top of page
|