Quote:
Originally Posted by Bob22341
Your problem comes when "child" calls "parent"
In c++ once you have included a file once, you can't do it again without causing build errors. You create a continual loop with including parent and chile again and again.
If you want to go into inheritance issues and calling parent functions you can, there is an easier way. Create another file called "parenta" and copy over all of the code from "parent" Then slightly change all of the function and class names to avoid build errors, and your almost done.
Change "child" to call "parenta" instead of "parent" and problem solved.
"parent" should include "child" which should include "parenta"
Hopefully that solves your problem 
|
This is not for the null reference exception, is it?
Thanks, anyway, but I think I got the original problem one fixed. The dynamic cast thing seems to be working. This program is already taking much longer than excepted...quite frustrating.
Again, thanks...I really need to get going on this thing.
Ok here is my function in DataView.cpp:
Quote:
Main^ main = dynamic_cast<Main^>(this->MdiParent);
for(count = 1; count < 11; count++)
{
while(main->serialPort1->BytesToRead < 1);
value = main->serialPort1->ReadByte();
value <<= 8;
value += main->serialPort1->ReadByte();
List_Select(count, value);
} // FAILS right after this if there is line after
main->done_flag = 1; //Here
main->~Main(); //Or here if the above line is commented out
|
System.NullReferenceException
I don't get it: I am just calling something else form the main after the ReadByte(), but I get an Null exception.
Any Ideas?