That depends : if those controls appear (instanciate) only in some cases, probably it is useful to declare them as pointers; otherwise, it is the same. Only you should be very carefull to release memory in pointer case.
Snakekaa
Move like a snake, think like a snake, be a snake !!!
Originally posted by dineshns
Please Tell me the reason ?
isn't there any difference of memory consumption?
Well...usig pointers always introduce the possibility of memory leaks, invalid addreses and such. There is basically no need to use them for the controls...
There might be really rare cases where you would use a pointer to controls for a good reasons in my eyes. Besides that, if you assign these member variables via the class wizard....then you only have one choice anyway...
Ciao, Andreas
"Software is like sex, it's better when it's free." - Linus Torvalds
Hi,
I think you need to use pointers if you have a custom control for which you want to call a user defined (non-default) constructor. Then I only know how to do this using new...
If smne knows how to solve the problem without the use of pointers please tell me.
Ok, I finally found a way that covers some cases:
Quotting from "The C++ Programming Language" (Stroustrup)
10.4.6.1 Necessary member Initialization
Member initializers are essential for types for which initialization differs from assignement - that is, for member objects of classes without default constructors, for const members, and for reference members...
Bookmarks