I used Inheritance in my program which was compiled by Borland C++ 5.02 compiler in DOS mode. But a runtime error occurs and the class object cannot be created. I tried the same program in Win32 mode and everything worked fine. But I need to code in DOS mode since I use BGI graphics in my program.
Please Help to solve this issue.
there is no problem with the code since it works in Dev cpp, MSVC and even in Borland C++ (Win32 mode). The question how can I do inheritance in Borland C++ (Dos mode).
Exaclty the same way, it's a feature of C++ not the particular compiler.
> there is no problem with the code since it works in Dev cpp, MSVC and even in Borland C++ (Win32 mode).
Works with "x" but doesn't work with "y" usually points to some problem in your code. Normally of course it works in DOS and fails on a proper OS but the idea is still the same.
My first impression would be that you're running out of memory in DOS.
Are you checking all your memory allocations for returning NULL? Your old C++ compiler probably doesn't throw exceptions, and dereferencing NULL isn't immediately fatal.
I wrote a small program which impliment inheritance but still the same problem is there. Does Borland C++ (dos mode) does not support inheritance (only Borland C++ (win32) support inheritance)? or do I have to make any configurations in BC++ to make the program run in DOS mode?
Post your small program?
I don't know the detail of the evolution of C++, but maybe that old fossil compiler is simply too darn old to use anymore.
> But I need to code in DOS mode since I use BGI graphics in my program.
There are many better graphical APIs out there which are better suited to your OS / 32-bit Compiler / Graphics card.