Click here to Skip to main content
15,912,069 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralListBox problem Pin
Ivan Cachicatari11-Jan-05 18:54
Ivan Cachicatari11-Jan-05 18:54 
GeneralRe: ListBox problem Pin
basementman12-Jan-05 4:01
basementman12-Jan-05 4:01 
GeneralRe: ListBox problem Pin
Ivan Cachicatari12-Jan-05 7:27
Ivan Cachicatari12-Jan-05 7:27 
Generalprocess ID to process name Pin
2000ram11-Jan-05 18:22
2000ram11-Jan-05 18:22 
GeneralRe: process ID to process name Pin
Aamir Butt11-Jan-05 19:33
Aamir Butt11-Jan-05 19:33 
GeneralVirtual Destructors Pin
Neelesh K J Jain11-Jan-05 18:07
Neelesh K J Jain11-Jan-05 18:07 
GeneralRe: Virtual Destructors Pin
Cedric Moonen11-Jan-05 19:58
Cedric Moonen11-Jan-05 19:58 
GeneralRe: Virtual Destructors Pin
digwizfox13-Jan-05 7:16
digwizfox13-Jan-05 7:16 
I like this question. The other posting did a good job of explaining why the virtual destructor is needed. The reason you don't need a virtual constructor is that you are specifically telling the compiler what you want to instantiate.

You write

int i = 10;
CBase* pPointer;
pPointer = new CChild(i);

The concept of virtual functions is also described as dynamic run time binding. So the idea is that you call a function on the fully instantiated object and the system is smart enough to realize that since a function is virtual, the child class version of the function is called first. Then the child class can execute it's own code and may or may not ivoke the base class version of the function as well.

So virtual functions don't make sense during the construction process. The child class has to call the constructor for the base class from within it's own constructor. Once the construction of the class is complete, you can use the base class pointer to call virtual functions. If you tried to call any virtual functions from either of the constructors, I'm not sure what would really happen. I wouldn't recommend trying this as it really makes no sense. Seems like it would be an undefined operation that may or may not cause a crash.

Shawn
GeneralGDI Edit Questions, Please Help Pin
c++code10111-Jan-05 17:50
c++code10111-Jan-05 17:50 
GeneralCProgressCtrl problem in Status bar Pin
Neelesh K J Jain11-Jan-05 16:44
Neelesh K J Jain11-Jan-05 16:44 
GeneralNot a problem... Pin
Kochise11-Jan-05 21:51
Kochise11-Jan-05 21:51 
Generalgethostbyname C2143 Pin
Vadim Tabakman11-Jan-05 14:57
Vadim Tabakman11-Jan-05 14:57 
GeneralRe: gethostbyname C2143 Pin
Antony M Kancidrowski12-Jan-05 2:28
Antony M Kancidrowski12-Jan-05 2:28 
GeneralRe: gethostbyname C2143 Pin
Vadim Tabakman12-Jan-05 10:00
Vadim Tabakman12-Jan-05 10:00 
GeneralCRichEditView - Dragging file into Pin
Ed K11-Jan-05 14:41
Ed K11-Jan-05 14:41 
GeneralRe: CRichEditView - Dragging file into : ON_WM_DROPFILES() Pin
Ed K12-Jan-05 6:42
Ed K12-Jan-05 6:42 
Generalrecommend gui library Pin
Anonymous11-Jan-05 14:38
Anonymous11-Jan-05 14:38 
GeneralRe: recommend gui library Pin
Ed K11-Jan-05 14:45
Ed K11-Jan-05 14:45 
GeneralRetrieve FDT(File Directory Table) for specific folders!! !! Pin
LiYS11-Jan-05 13:41
LiYS11-Jan-05 13:41 
GeneralRe: Retrieve FDT(File Directory Table) for specific folders!! !! Pin
Maximilien11-Jan-05 14:03
Maximilien11-Jan-05 14:03 
GeneralRe: Retrieve FDT(File Directory Table) for specific folders!! !! Pin
LiYS11-Jan-05 14:21
LiYS11-Jan-05 14:21 
GeneralRe: Retrieve FDT(File Directory Table) for specific folders!! !! Pin
Maximilien11-Jan-05 16:05
Maximilien11-Jan-05 16:05 
GeneralRe: Retrieve FDT(File Directory Table) for specific folders!! !! Pin
LiYS11-Jan-05 16:18
LiYS11-Jan-05 16:18 
GeneralRe: Retrieve FDT(File Directory Table) for specific folders!! !! Pin
Maximilien12-Jan-05 0:41
Maximilien12-Jan-05 0:41 
QuestionHow to seek >2gb files with fseek? Pin
IGx8911-Jan-05 12:07
IGx8911-Jan-05 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.