Reputation: 1017
In using a struct item:
struct item
{
item();
~item();
char * name;
char * effect1;
char * effect2;
char * effect3;
char * effect4;
int count;
};
with the constructor:
item::item()
{
name = NULL;
effect1 = NULL;
effect2 = NULL;
effect3 = NULL;
effect4 = NULL;
count = 0;
}
Hovering over name shows:
char* name() const
while hovering over any of the effects shows:
char* effectx
I am wondering why this is happening as I believe the difference is causing me problems in other areas of my program. Thank you.
Upvotes: 0
Views: 246
Reputation: 3733
I don't think the declaration you have presented is quite the same as the code the IDE is seeing. One good way to work on the problem is to duplicate the code into a separate working file (in a separate project) and move all the code (both declaration and the example code showing the problem) into the same file. Then remove unrelated parts of the code so that you slowly move towards the smallest, most condensed, example that still shows your problem.
Then post that code as an update to your question.
Meanwhile, you're not defining your constructor quite correctly. Well it's correct, but not the best style. Don't initialise members in the body of the constructor, initialise them like this:
item::item() :
name(NULL), effect1(NULL), effect2(NULL), effect3(NULL), effect4(NULL), count(0)
{
/* nothing in the body. */
}
Upvotes: 1