I have this problem with my begginer program. For some reason the constructor for my Database doesn't allocate NULL for my object. Somehow it also creates new space for my structure pointer "Duom" and I don't even know how that's possible.
Well you can see everything in this picture, P1 has the same constructor (altough in a different class), and it does a fine job. But with "Db" something's wrong.
Can anyone advise me on what should I try to debug? The brakepoint for this information is before anything is done with the information. Thanks.
I noticed that whatever is in the first place of the private: section. In this time (
MazgasDB *DuombazesPradzia; ) that pointer gets a random no matter what is in the constructor.
I don't really get what's going on. I can put MazgasDB *SoakUpErrorPointer; in the first place and then it's fine.
It could be something else in your program that is wrong. If some other part of the code overwrites some memory by accident it could affect other objects like this.
Do you get this program if you create an empty project with only the Duombaze objects in it?
I've got the same problem by creating an empty project..I tried that.
found out my problem though,
for some reason:
Duombaze *Db;
Db = new Duombaze;
This method works. It nicely creates an object with NULL everywhere.
Could anyone explain why this work and not just
Duombaze Db;
I'm working with Windows forms applications. I transfered everything to the Form private:
Duombaze *Db; works fine, but if I try Duombaze Db; it says that mixed types are not allowed. I guess it has something to do with this?
I've read that the form only accepts dynamic types, and I need to use it so all the functions in the form could see the object, but I used the simple Duombaze Db; in global, so what's exactly happening here?
Why did the first pointer of the private: section got a random error when I just did Duombaze Db?