| View previous topic :: View next topic |
| Author |
Message |
Ellis Guest
|
Posted: Wed Dec 10, 2003 11:24 pm Post subject: operator new |
|
|
Hi :)
How can i override the operator new of a form that inherits from TForm ?
TForm::operator new() ...
Ellis
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Dec 10, 2003 11:32 pm Post subject: Re: operator new |
|
|
"Ellis" <ellis.antaya (AT) integratik (DOT) qc.ca> wrote
| Quote: | How can i override the operator new of a form that inherits
from TForm ? TForm::operator new() ...
|
Why do you need this exactly? The VCL has its own memory manager, and
expects as much. Overriding the 'new' operator is most commonly done to
provide custom memory management, which I do not recommend you do for VCL
objects.
Gambit
|
|
| Back to top |
|
 |
Ellis Guest
|
Posted: Fri Dec 12, 2003 7:13 pm Post subject: Re: operator new |
|
|
| Quote: | How can i override the operator new of a form that inherits
from TForm ? TForm::operator new() ...
Why do you need this exactly? The VCL has its own memory manager, and
expects as much. Overriding the 'new' operator is most commonly done to
provide custom memory management,
That's what i want to do  |
| Quote: | which I do not recommend you do for VCL objects.
Why not ? |
Ellis
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Dec 12, 2003 8:59 pm Post subject: Re: operator new |
|
|
"Ellis" <ellis.antaya (AT) integratik (DOT) qc.ca> wrote
Because the VCL is written in Delphi, not C++, and as such plays by Delphi
rules. The VCL does not use the 'new' (and 'delete') operators to begin
with, because they are C++ operators, they do not exist in Delphi. The VCL
has its own memory management system that should be used instead. If you
must provide your own memory management for the VCL, then have a look at the
SetMemoryManager() function.
Gambit
|
|
| Back to top |
|
 |
|