|
-
July 19th, 2005, 06:59 AM
#5
Re: Some Questions
 Originally Posted by NMTop40
I don't quite understand the question but you can do sizeof( *this ). If "this" is a pointer to a base class, I think sizeof( *this ) will give you the size of the base class not the derived class, i.e. it's not a polymorphic operation.
NMTop40, I guess he is asking if there are any memory allocations done for the this operator..basically he is, I guess making a mistake by even calling the this as an operator rather than a pointer. And then he is asking what size if allocated for it.
So I guess the answer he is looking for is - this is a pointer not an operator. you can find the size of the this pointer by using sizeof operator on this i.e. sizeof(this). About the storage location. I guess its the stack or heap depending upon the way the object pointed to by this is created. Correct me if I am wrong here.
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|