dpc8v@hopper.cs.Virginia.EDU (Douglas P. Coppage) (07/05/90)
I am using g++ version 1.37.1 on a NeXT. My application requires that objects of a certain class (call it "fido") have data structures of differing sizes. That is, the constructor for fido will have, as one of its parameters, the number of bytes that should be allocated for the new fido's data. I have tried to overload new(), but v. 1.37 yields a parse error when I use the syntax shown in the C++ books I use; I think new() can be overloaded only in v. 2.0+. I have also used the "-fthis-is-variable" compiler directive, and sure enough: the compiler allows assignments to "this", but the assignment does not survive the change in scope! Once I return from the constructor to the caller, "this" is has the value it did at the beginning of the constructor, not the value I assigned it later on in the constructor. I have tried to find on-line information about g++, but none is available. Question: Am I stuck? Can I get g++ to create new fidos of varying sizes? E-mail responses will be greatly appreciated. Doug Coppage (dpc8v@virginia.edu)