I would venture to guess that your explicit call to the destructor causes the destructor to be executed, setting m_Val to 5, but the destruction has little effect until something else overwrites the...
Type: Posts; User: DirkMaas
I would venture to guess that your explicit call to the destructor causes the destructor to be executed, setting m_Val to 5, but the destruction has little effect until something else overwrites the...
The functions that return Number instead of Number& are returning temporary objects, and the compiler always makes temporary objects const. These const objects can't be used as non-const arguments. ...
Yes, it is valid, though you lose the address of "some string" for good when you re-assign pszString to something else. Both strings are stored in the static data area, and so go out of scope, and...
Sorry, that was a using directive in your header file, not a using declaration.
The reason it's not a good idea to put a using directive in a header file is that it opens the namespace in every...
Assuming that you want to declare findEdge() and the others as const member functions, the proper syntax is
EdgeNode* findEdge(const int &source,const int &dest) const;The compiler is complaining...
For rounding, do an internet search for "C++ round number." You'll get a bunch of hits. There's some code here: CIS Department > Tutorials > Software Design Using C++ > Arithmetic and Formatting of...
Basic question, but are you sure your DATA folder is named InputFiles? Your post indicates that you're stopping in getDir(). With errno=2, strerror(errno) gives "No such file or directory." Using...
In cases like this, it's a good idea to try to isolate the problem. Comment out everything that's not related to opening the file. Hardcode the file name in the call to open().
I played around...
There are good resources on this site and on the web, but you need to dig. Try C and C++ Compiler Information and Reviews - Cprogramming.com for starters.
If someone explains it to you, you'll be deprived of the satisfying experience of figuring it out for yourself. Do you have a debugger? If so, run it on these programs, examining variables as you...
Inherited classes contain the members of their base classes (the classes they inherit from). Because Car inherits from Vehicle (as you have defined them), when you create a Car, it will have the...
Since the constructor calls in the initializer list are made before the statements in the body of the constructor are executed, the list makes it possible have a fully created and initialized object...
You're not calling mySquareRoot() correctly in the do loop. In that loop, replace mySquareRoot with mySquareRoot(num).
The way your loop is structured right now, you'll try to find the square...
That is a constructor for struct node. The braces
{} indicate that it is in inline form. The colon and the statements before the braces are the initializer list. For more info on initializer...