"scalar deleting destructor" 
Author Message
 "scalar deleting destructor"

Hi Kelli,

Note that new MyClass; returns a pointer.  It seems the compiler is
allowing you to create an instance in the heap and copying it to another
instance.  Try MyClass* pMC = new MyClass;  delete pMC;

G'd day!
Leo Vildosola



Fri, 17 Sep 1999 03:00:00 GMT  
 "scalar deleting destructor"

Hello all!

Has any one seen this error ("scalar deleting destructor") in the call
stack?  I've found two old KB articles, neither of which seem to apply
to what I'm doing.   (I'm not in a DLL and I'm using verion 4.2b.)

I think I'm doing something pretty simple. Here are the basic classes:

class MyClass : public CObject
{
        MyClass();
        virtual ~MyClass(); // Does nothing in the cpp

protected:
        CString m_strName;

Quote:
}

Any time I delete these ojects (after 'new'ing them) I get the "scalar
deleting destructor" on the call stack.

        MyClass mC = new MyClass;
        delete mC;

Any tips and/or pointers ;) would be *greatly* appreciated.
Thank you very much,
Kelli

--

http://www.inlet.com



Fri, 17 Sep 1999 03:00:00 GMT  
 "scalar deleting destructor"

Sorry, posting error:

        MyClass *mC = new MyClass;
        delete mC;

I do have a pointer, I just forgot the star in my example.

Thanx,
Kelli

Quote:

> Hi Kelli,

> Note that new MyClass; returns a pointer.  It seems the compiler is
> allowing you to create an instance in the heap and copying it to another
> instance.  Try MyClass* pMC = new MyClass;  delete pMC;

> G'd day!
> Leo Vildosola



Fri, 17 Sep 1999 03:00:00 GMT  
 "scalar deleting destructor"


wizard created project's View destructor, it has a "scalar deleting
destructor" message on the call stack.  That's with none of my code in
there.

I checked, and all destructors are virtual.  (Both for the CView base
and derived classes and my classes.)  Is this a bogus message?  Or is
there something truely wrong here?

Thanx for your time,
Kelli

Quote:

> Hi Kelli,

> Note that new MyClass; returns a pointer.  It seems the compiler is
> allowing you to create an instance in the heap and copying it to another
> instance.  Try MyClass* pMC = new MyClass;  delete pMC;

> G'd day!
> Leo Vildosola



Sun, 19 Sep 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. "scalar deleting destructor"

2. "deleting destructor" problem

3. What is a scalar deleting destructor?

4. What is a scalar deleting destructor?

5. scalar deleting destructor?

6. Adding to "application destructor" code

7. Why can only undo "Delete"?

8. Delete "/" from char pointer

9. Deleting with "fwrite()"

10. ODBC, VFP and "real" deletes

11. how to use "delete"?

12. "delete []" in MSDN

 

 
Powered by phpBB® Forum Software