Click here to Skip to main content
15,908,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Question about window's state!!! Pin
kokehqyu3-Mar-05 17:39
kokehqyu3-Mar-05 17:39 
GeneralDevstudio addin Ques Pin
Jetli Jerry2-Mar-05 18:37
Jetli Jerry2-Mar-05 18:37 
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 
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 
ng kok chuan wrote:
pointer[0] = *(new Base);<br />
pointer[1] = *(new Derive1);<br />
pointer[2] = *(new Derive2); and so on...

This what is known a late binding

ng kok chuan wrote:
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.

How about putting the virtual before the name of the function (in the base class)


ng kok chuan wrote:
vector < Base* > pointer)<br />
pointer[0] = *(new Base);



doesn't make sense
Surely, it shold be

pointer[0] = new Base;

Anyway, I got a sample app to give you an idea. If you e-mail I'll gladly send it to you.

Happy programming
Alton
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 

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.