Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMFC MDI with sound! Pin
Member 14844962-Mar-05 18:24
Member 14844962-Mar-05 18:24 
GeneralRe: MFC MDI with sound! Pin
David Crow3-Mar-05 2:17
David Crow3-Mar-05 2:17 
Questionhow do i..... Pin
namaskaaram2-Mar-05 17:27
namaskaaram2-Mar-05 17:27 
AnswerRe: how do i..... Pin
Steen Krogsgaard2-Mar-05 21:12
Steen Krogsgaard2-Mar-05 21:12 
GeneralRe: how do i..... Pin
namaskaaram2-Mar-05 22:08
namaskaaram2-Mar-05 22:08 
GeneralRe: how do i..... Pin
Steen Krogsgaard2-Mar-05 23:47
Steen Krogsgaard2-Mar-05 23:47 
GeneralRe: how do i..... Pin
namaskaaram3-Mar-05 17:28
namaskaaram3-Mar-05 17:28 
GeneralProblem with polymorphism Pin
ng kok chuan2-Mar-05 17:14
ng kok chuan2-Mar-05 17:14 
i'm facing a problem with polymorphism currently and need help.

i've 1 base class, let's call it Base, and 2 Derived class, Derive1 and Derive2. Base is NOT an abstract class.

on top of these 2, i've a container class Container that contains a vector of Base pointers. (i.e. vector < Base* > pointer)

now in Container, there's a function called init() that will initialize the vector of pointers and according to the type of class it belongs to.

e.g.
pointer[0] = *(new Base);
pointer[1] = *(new Derive1);
pointer[2] = *(new Derive2); and so on...

the type of classes are created correctly when the constructors are called. however, when i tried to access the pointers again later in my program, the program only treats each pointer as Base and no longer as any derived classes. thus polymorphism cannot work at all... this is crucial to me as i have several classes that's supposed to belong to the vector of pointers. if i use a simple array polymorphism works. but i need the vector....

please help!!
GeneralRe: Problem with polymorphism Pin
Ryan Binns2-Mar-05 17:17
Ryan Binns2-Mar-05 17:17 
GeneralRe: Problem with polymorphism Pin
ng kok chuan2-Mar-05 17:23
ng kok chuan2-Mar-05 17:23 
GeneralRe: Problem with polymorphism Pin
Ryan Binns2-Mar-05 22:27
Ryan Binns2-Mar-05 22:27 
GeneralRe: Problem with polymorphism Pin
ng kok chuan3-Mar-05 14:31
ng kok chuan3-Mar-05 14:31 
GeneralRe: Problem with polymorphism Pin
David Crow3-Mar-05 2:35
David Crow3-Mar-05 2:35 
GeneralRe: Problem with polymorphism Pin
ng kok chuan2-Mar-05 20:01
ng kok chuan2-Mar-05 20:01 
GeneralRe: Problem with polymorphism Pin
Cedric Moonen2-Mar-05 20:36
Cedric Moonen2-Mar-05 20:36 
GeneralRe: Problem with polymorphism Pin
Steen Krogsgaard2-Mar-05 21:40
Steen Krogsgaard2-Mar-05 21:40 
GeneralRe: Problem with polymorphism Pin
Alton Williams5-Mar-05 4:03
Alton Williams5-Mar-05 4:03 
GeneralC++ Wrapper for libCURL Pin
a_diwakar2-Mar-05 17:02
a_diwakar2-Mar-05 17:02 
Questionhow to use a video codec to compress avi file Pin
Mohsen Saad2-Mar-05 15:22
Mohsen Saad2-Mar-05 15:22 
GeneralText to matrix conversion Pin
SeanSheehan2-Mar-05 14:32
SeanSheehan2-Mar-05 14:32 
GeneralSmall executables Pin
Verolix2-Mar-05 13:49
Verolix2-Mar-05 13:49 
GeneralRe: Small executables Pin
ThatsAlok2-Mar-05 18:00
ThatsAlok2-Mar-05 18:00 
Generalresizing workarea Pin
ahto1112-Mar-05 12:07
ahto1112-Mar-05 12:07 
GeneralC++ library Pin
Ahmed Adel2-Mar-05 11:33
Ahmed Adel2-Mar-05 11:33 
GeneralRe: C++ library Pin
ThatsAlok2-Mar-05 18:10
ThatsAlok2-Mar-05 18:10 

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.