devxlogo

Inheritance and Memory Allocation

Inheritance and Memory Allocation

Question:
I can’t create an instance of the derived class using operator new. The base and the derived classes differ only by a virtual function. The error messages I receive at runtime asks me to specify the path for files like:

new.asm, strncpy.asm

Answer:
You didn’t mention what compiler you’re using but it sounds like you’re attempting to step into the implementation code of operator new using Visual C++ debugger. Normally, you don’t need to do that. Simply use the “step over” command to exit from it. Instead, set a break point in constructor of the class whose instance you’re attempting to create.

You should note that many time-critical, low-level functions like memcpy, strncpy, memset etc. are written in assembly. When the compiler sees a call of such a function, it inserts its assembly code inline (rather than actually calling a function). When you try to step into the called function, the debugger needs to know where the assembly source files of these functions are located. You can find them in the Visual C++ installation CD (simply run a search to locate these files and then direct the debugger to look for them on the CD).

See also  How HealthStream Learning Center Supports Healthcare Education and Compliance
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist