home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!hamblin.math.byu.edu!sol.ctr.columbia.edu!usc!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!news.aero.org!Aero.org!slewis
- From: slewis@Aero.org (Steven Lewis)
- Newsgroups: comp.os.ms-windows.programmer.win32
- Subject: Re: MSC++ problems with override delete
- Date: 6 Nov 1992 16:18:31 GMT
- Organization: The Aerospace Corporation
- Lines: 36
- Distribution: world
- Message-ID: <1de5snINN1im@news.aero.org>
- References: <1dbi2gINNpo6@news.aero.org>
- NNTP-Posting-Host: antares.aero.org
-
- In article <1dbi2gINNpo6@news.aero.org>, slewis@aero.org (Steven Lewis) writes:
- |>
- |> Microsoft C gives me errors when I try to override the delete
- |> operator - the code fragment below accepts overriding new with no
- |> difficulty but gives errors on foo::delete. Borland, Zortech,
- |> Sun C++, gnu and Think C all think the syntax below is acceptable.
- |>
- |> #include <stdio.h>
- |>
- |> extern void *my_alloc(size_t Size);
- |> extern void my_free(void *Data);
- |>
- |> class foo
- |> {
- |> void* operator new(size_t objSize);
- |> void operator delete( void* objStorage);
- |> };
- |>
- |>
- |> void *foo::operator new(size_t objSize)
- |> {
- |> ObjectD *TheObject;
- |> TheObject = (ObjectD *)my_alloc(objSize);
- |> return(TheObject);
- |> }
- |>
- |>
- |> void foo::operator delete( void *objStorage)
- |> {
- |> my_free(objStorage);
- |> }
- |>
-
- Actually I tested the above code and it WORKS! It fails when I
- name the class ObjectD rather than foo - this is name I use.
- What is the conflict with ObjectD??
-