lss123 19 Newbie Poster

Hello- I'm using VB.NET (visual studio) to create a chatbot (a program that mimics a human and has a text converstion with you). Two of my main classes are a word class and a sentence class. The sentence object is basically going to be a linked list of words objects.

Here's my question: as the program executes, many word objects will be instantiated, and so will many sentence objects. But, each class (used to create the object) has several constants, procedures, and functions defined. For each object instantiated, are new copies of the constants, procedures, and functions created in memory? Or, is only one copy of the constants and procedures created?

I hope my question is clear. My fear is that, since many many objects will be created during program execution (each word of a sentence will be an object), that if the constants/procedures/functions are defined in memory again and again, that I'll run out of memory.

If this is the case, what is the best way to structure my program so that the objects created contain only the variable data, and the constants/procedures/functions are defined only once?

lss123 19 Newbie Poster

In response to the above question, the program provided is just an example program to illustrate the bug. That is why I declare ifstream. There is no logical purpose, just an illustration of the problem I'm having.

I've found a work-around, so I'm going to go forward with that. Here's the epilogue to this thread:

1) I narrowed down the problem to the Borland linker, ilink32.exe. I did this by copying the two commands from borland (one command for the compiler, and one for the linker) and trying them outside of codeblocks. The compiler commands (bcc32 -c) both outside and inside codeblocks produce almost identical files, so I concluded that isn't the problem. However the linker command, when used both outside and inside codeblocks, produces an executable with the same error -- so, the this is how I narrowed the problem down to the linker (and not a codeblocks bug). Strangely, when I simply call bcc32 without the "-c" option, the executable created works fine. So, compiling using bcc32 to an object file, then linking to an executable is when the problem happens. I'd love to find out exactly why, but I must move on.

2) Why did I say earlier that it failed with the GCC compiler as well? This may be a bug in codeblocks. In mid project, I switched my compiler from borland to GCC, and at this point the program didn't even compile. I misread the results, and assumed my error was the …

Dave Sinkula commented: Great followup. +19