home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!uknet!mcsun!fuug!kiae!demos!newsserv
- From: mike@istech.msk.su (Michael Korotkih)
- Newsgroups: comp.lang.c++
- Subject: Re: Operator "new" - how to catch array-allocation?
- Message-ID: <AAtppDh498@istech.msk.su>
- Date: 22 Dec 92 16:06:15 GMT
- References: <1992Dec14.143339.26314@daimi.aau.dk>
- Sender: news-service@newcom.kiae.su
- Reply-To: mike@istech.msk.su
- Organization: Information Systems and Technologies
- Lines: 31
-
-
- > A* a=new A[25];
-
- > the global new operator is used, it seems! Can it be true, it should
- > work like this?
- YES. A::new used only if you allocate exactly one object of
- class A or derived from A ( size == sizeof( classname ) ),
- if you use this for derived class, size will be bigger.
-
-
- > Until I tried, I thought, A's 'new' would just get a bigger
- > argument - but maybe there is a very good reason, it works like this?
- > Please tell me about it! No way to catch array-allocation for a class?
- You can override global ::operator new. If you want execute
- class - specific initialization, may be constractor - the best place.
-
-
- > Same question goes for 'delete'. Comments and explanations greatly
- > appreciated!
-
- delete behavior is the same.
-
- > -- Morten.
-
- > ---------------------------------------------------------------------------
- > Morten Sabroe Mortensen, e-mail: sabroe@daimi.aau.dk
- > Department of Computer-science - University of Aarhus, Denmark.
- > ---------------------------------------------------------------------------
-
-
- Michael Korotkih
-