473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

this pointer - deletion

Can we delete 'this' pointer in C++.
If so how can we delete this pointer?
If not why?

Aug 9 '07 #1
4 2196
sr*********@gmail.com wrote:
Can we delete 'this' pointer in C++.
If so how can we delete this pointer?
If not why?
Why would you want to?

--
Ian Collins.
Aug 9 '07 #2
On Aug 9, 12:31 pm, srini4va...@gmail.com wrote:
Can we delete 'this' pointer in C++.
If so how can we delete this pointer?
If not why?
http://www.parashift.com/c++-faq-lit...html#faq-16.15

-N

Aug 9 '07 #3
sr*********@gmail.com wrote:
Can we delete 'this' pointer in C++.
If so how can we delete this pointer?
If not why?
Yes, you can delete the this pointer.

After calling "delete", you must not reference any non static member
variables or non static functions. Anything that causes you to
dereference the "this" pointer is bad news.
Aug 9 '07 #4
Ian Collins wrote:
sr*********@gmail.com wrote:
>Can we delete 'this' pointer in C++.
If so how can we delete this pointer?
If not why?
Why would you want to?
Please ignore the above, I misread the question....

--
Ian Collins.
Aug 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: mufasa | last post by:
i believe deleting an already delete pointer should give me a segmentation fault! Why, then, is the following working? I am using gcc version 3.0.2. #include<stdio.h> #include <string> using...
51
by: Joe Van Dyk | last post by:
When you delete a pointer, you should set it to NULL, right? Joe
31
by: Anamika | last post by:
Hello friends.... can anyone tell me what will happen when we do..."delete this"...
10
by: ac.c.2k7 | last post by:
Hello Everyone, The solution to this is to copy the data from the next node into this node and delete the next node!. 1. But if the node to be deleted is the last node. Then what should we do ?...
2
by: Kai-Uwe Bux | last post by:
Does the following have undefined behavior? struct X; struct Y { X * x_ptr; Y ( void ) : x_ptr ( 0 )
3
by: Yuvanya | last post by:
Hi, I have a map that stores pointer objects. I am not able to delete these pointer objects from the map. For loop that gets each element of the map from begin() to end() and deletes that...
10
by: H.S. | last post by:
Hello, I have class in which I am allocating space for a double array in the constructor. I use the double array twice in one of the methods and then delete that array in the class's destructor....
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
8
by: Rahul | last post by:
Please read the following code class Test{ public: void * operator new (size_t t) { return malloc(t); } void operator delete (void *p) { free(p); } };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.