Click here to Skip to main content
15,917,321 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WaitForSingleObject - Handle for ShellExecute() Pin
David Crow29-Mar-04 5:07
David Crow29-Mar-04 5:07 
GeneralRe: WaitForSingleObject - Handle for ShellExecute() Pin
ndalal29-Mar-04 6:09
ndalal29-Mar-04 6:09 
GeneralRe: WaitForSingleObject - Handle for ShellExecute() Pin
David Crow29-Mar-04 6:20
David Crow29-Mar-04 6:20 
GeneralRe: WaitForSingleObject - Handle for ShellExecute() Pin
Michael Dunn29-Mar-04 8:45
sitebuilderMichael Dunn29-Mar-04 8:45 
GeneralPrinting in a dialog based application Pin
Member 426420329-Mar-04 4:12
Member 426420329-Mar-04 4:12 
GeneralRe: Printing in a dialog based application Pin
Antti Keskinen29-Mar-04 4:38
Antti Keskinen29-Mar-04 4:38 
GeneralRe: Printing in a dialog based application Pin
Roger Allen30-Mar-04 0:53
Roger Allen30-Mar-04 0:53 
Questionstatic array of base class pointers?? Pin
LudaLuda29-Mar-04 4:00
LudaLuda29-Mar-04 4:00 
Hey guys,

here is the problem:

I have to keep an static array of pointers of type base class , and I should be able to assign each of these pointers to any of the derived class..

here is the code...

class Base
{
public:
static Base* basePtr[10];
}

class derived1 : public Base
{ }

class derived2 : public Base
{}


now in my main.cpp I want to be able to create objects of derived1 or derived2 and assign the basePtr to point to them....

how do I do that???

.....
...
derived1 d1
Base::basePtr[1] = &d1 // I tried this approach, the problem is...does this mean I have to have 10 different classes of d1 or d2 and then assign each of their references to the basePtr ??? Is there way to do this dynamically so that I do some thing like the following

Base::basePtr[1] = new derived1;

Pls help..

thanks






AnswerRe: static array of base class pointers?? Pin
ohadp29-Mar-04 4:37
ohadp29-Mar-04 4:37 
GeneralRe: static array of base class pointers?? Pin
LudaLuda29-Mar-04 4:53
LudaLuda29-Mar-04 4:53 
GeneralRe: static array of base class pointers?? Pin
ohadp29-Mar-04 4:57
ohadp29-Mar-04 4:57 
GeneralAdd protocol programatically Pin
Reza Shademani29-Mar-04 3:42
Reza Shademani29-Mar-04 3:42 
GeneralPNP_INFO again Pin
Member 67007929-Mar-04 3:33
Member 67007929-Mar-04 3:33 
Generalexpert advice needed (query results) Pin
BlackDice29-Mar-04 3:22
BlackDice29-Mar-04 3:22 
GeneralRe: expert advice needed (query results) Pin
David Crow29-Mar-04 4:29
David Crow29-Mar-04 4:29 
GeneralRe: expert advice needed (query results) Pin
BlackDice29-Mar-04 5:04
BlackDice29-Mar-04 5:04 
GeneralRe: expert advice needed (query results) Pin
ohadp29-Mar-04 4:30
ohadp29-Mar-04 4:30 
GeneralRe: expert advice needed (query results) Pin
basementman29-Mar-04 4:40
basementman29-Mar-04 4:40 
GeneralRe: expert advice needed (query results) Pin
BlackDice29-Mar-04 5:06
BlackDice29-Mar-04 5:06 
General[eVC] Internationalization and Multiple Language Support Pin
GuilhemMtp29-Mar-04 2:51
GuilhemMtp29-Mar-04 2:51 
GeneralRe: [eVC] Internationalization and Multiple Language Support Pin
ohadp29-Mar-04 4:27
ohadp29-Mar-04 4:27 
GeneralRe: [eVC] Internationalization and Multiple Language Support Pin
Anonymous30-Mar-04 7:50
Anonymous30-Mar-04 7:50 
GeneralRe: [eVC] Internationalization and Multiple Language Support Pin
ohadp30-Mar-04 18:53
ohadp30-Mar-04 18:53 
GeneralSelf-decoding application Pin
Member 97865129-Mar-04 2:36
Member 97865129-Mar-04 2:36 
GeneralRe: Self-decoding application Pin
Antony M Kancidrowski29-Mar-04 3:00
Antony M Kancidrowski29-Mar-04 3:00 

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.