please have a look at this code.
Code:
class A {
public:
explicit A(int);
};
main()
{
A obj=8;
}
What could be the possible reason and its solution?
Thanks
|
Contributor
|
|
| 17May2010,13:54 | #1 |
|
Hi,
please have a look at this code. Code:
class A {
public:
explicit A(int);
};
main()
{
A obj=8;
}
What could be the possible reason and its solution? Thanks |
|
Mentor
|
![]() |
| 18May2010,14:15 | #2 |
|
Usage looks OK. What compiler are you using? Is it one that doesn't support the "explicit" keyword?
|
|
Contributor
|
|
| 19May2010,07:00 | #3 |
|
I am using Turbo C++ version 3. Which version should i use?
Thanks. |
|
Mentor
|
![]() |
| 19May2010,12:12 | #4 |
|
Certainly not an ancient compiler that was actually coded by a dinosaur, that's for certain.
You will need to use a modern compiler if you want to use modern languages. gcc does a good job of keeping up with the times, or you could use the Microsoft compilers (downloadable for free from MSDN). |
|
Contributor
|
|
| 20May2010,14:02 | #5 |
|
I have Visual Studio 2008. But i don't know how to create C++ application on them.Can you guide?
Thanks, |
|
Mentor
|
![]() |
| 20May2010,14:52 | #6 |
|
It's really not hard. File -> New -> Project; in Project Types pick Win32 under Visual C++.
What happens next depends on what kind of project you want. Given that your ability is such that you can't find File New Project, I suggest starting with the template Win32 Console Application. Give it a name and location, it will create a basic project that you can build and run (maybe after adding a line to display Hello World) using the cunningly named menu Build -> Build Solution. After building, fix any compile errors, then use the menu Debug -> Start Without Debugging to run the program. |