×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    16

    overloading delete operator

    hi

    I am overloading delete operator as follows

    Code:
    void operator delete [](unsigned int aSize,bool, bool)
    {
    
    }
    I get compile time error "illegal 'operator" declaration

    how do I fix this?
    Mihir

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: overloading delete operator

    try like this

    Code:
    void operator delete[](void *p)
    {
    
    }

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    16

    Re: overloading delete operator

    cool!

    I have overloaded it as show below:
    Code:
    void operator delete [](void *p,int)
    {
    
    }
    how do I invoke the overloaded operator say

    Code:
    	int i = 10;
    	MyClass *pClass = new(i) MyClass[3];
    	delete[]pClass; // how do I invoke my overloaded operator

  4. #4
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    80

    Re: overloading delete operator

    HI ,
    include your class name like void yourappname:perator delete [](unsigned int aSize,bool, bool)

Similar Threads

  1. Overloading all new and delete operators
    By navjotsingh1979 in forum Symbian
    Replies: 1
    Last Post: 2007-06-08, 08:55
  2. overwrite operator new and delete
    By toughworker in forum Symbian
    Replies: 0
    Last Post: 2005-02-01, 20:15
  3. Replies: 2
    Last Post: 2004-11-17, 10:20
  4. how can i delete operator logo on 7650
    By ekaluck in forum Digital Rights Management & Content Downloading
    Replies: 1
    Last Post: 2002-12-09, 14:00
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×