It appears the author is using just a normal class, nothing constant, and from the quote I mentioned it looks to me that his only reasoning was "It helps prevent errors."
In fact, in an earlier...
Type: Posts; User: Loduwijk
It appears the author is using just a normal class, nothing constant, and from the quote I mentioned it looks to me that his only reasoning was "It helps prevent errors."
In fact, in an earlier...
I am reading something about C++, and it says "Methods that never change a class member value should be declared as constant using the const keyword in both the declaration and definition. This...
Ah yes, thank you. I wasn't thinking about the unsigned integer part. That makes sense that it would cycle back around to the maximum value of the unsigned long int from the num2text function.
I...
I didn't see how that could affect the output there, unless it was num2text's fault, but I haven't had a problem with that function yet. Either way, here they are.
//my point class
class point...
I have the oddest problem now that I can't figure out. In my GetAngle function, I have a float that is the difference of two other floats and it is not calculating right. I have stripped everything...
That math.h it mentioned did the trick. Thanks again.
I feel my headache going away already.
(edit)
It's been a while, but didn't there used to be a way to mark my thread as resolved? The...
I've been digging on this site and through google, but I can't find an arccos function anywhere; all I find are discussions about it and about dot products which I don't understand, it's all theory...
Since I couldn't get Dev-C++ to work again (I went so far as to uninstall, delete every remnant of dev-c++ related stuff left over that I could see, reboot, defrag, reboot, redownload the setup again...
How do I use the hexidecimal system in my code? Something like...
int my_int = F61B;
And other numbering systems for that matter, though hexidecimal is the only one I actually need for the...
Alright, I just tried that and it's still screwed up.
Is it possible that the compiler after corruption could have corrupted the project files? Should I try recreating the projects from scratch,...
Yes, and at first it was compiling just fine when I try it on my other project. However, I just updated my original post at the same time you replied; apparently, it is crashing on the other project...
(update)
Ack! I thought it was that program because the compiler was working fine yesterday, and just today when I start this new one it starts crashing. However, the compiler is crashing now even...
*sigh* That's what I was afraid of. Thanks.
If you overload a class' constructor and then use that new constructor, are derived classes then forced to define the new constructor as well?
With the default constructor, I could just do...
(edit)
I just made the contents vector a vector of atom pointers rather than atom references, and that at least ends up outputting contents[0]->name. It appears to at least be adding the things.
...
Which code, the last one that I said works? It was just an example, not the actual code that I have. Still, I'm using Bloodshed's Dev-C++.
Even so, what was wrong with it that would make it not...
For a class I have, it uses a vector to keep track of objects that are "in" it. I've recently restructured my code, and it is now broken. It does not keep track of objects correctly.
Everything...
Took some time to find something that explained it well enough, but I did. I doubt I'll be able to remember that though, so I bookmarked it the explanation I found.
Thanks much.
Is there a way to tell what type of class an object is?
I want to tag objects of a few types with an id integer, and I want the classes to have seperate id index counters. The problem I'm running...
Same example as before.
object1
{
public:
object1(void)
{cout << "This is object1, the base class. I do not want this to be be output when you are creating an object2.\n";}
};
object2
Thank you for confirming that for me, 7stud.
So then, if I want to have different things happen when base and derived classes are made, and the things for the derived class should not include...
That's my whole point; it doesn't work.
Well, to be honest, I didn't try the entirety of the book's code example. The example I gave was not a direct quote from the book. The book's example is...
The "void special_item(void){}" line is to override the parent type's constructor. I don't understand why it works this way, but I'm just following what it says in my book. Though further tests show...
And what does that mean? What is a method signature? Do you refer to the parameter thing I mentioned?
Indeed I do, concerning item_id. It's a global variable that starts at 0, that's all.
So I...
I'm trying to use inheritance now to make things much more organised. I have a superclass of type item and an inheriting class of type special_item.
The book I'm reading an example from has...