Click here to Skip to main content
15,890,186 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Registry and VISTA Pin
Maxwell Chen13-Mar-08 18:56
Maxwell Chen13-Mar-08 18:56 
GeneralRe: Registry and VISTA Pin
Bram van Kampen12-Mar-08 15:37
Bram van Kampen12-Mar-08 15:37 
GeneralRe: Registry and VISTA Pin
Mark Salsbery29-Feb-08 7:49
Mark Salsbery29-Feb-08 7:49 
GeneralRe: Registry and VISTA Pin
Bram van Kampen29-Feb-08 14:25
Bram van Kampen29-Feb-08 14:25 
GeneralRe: Registry and VISTA Pin
Bram van Kampen12-Mar-08 15:35
Bram van Kampen12-Mar-08 15:35 
GeneralRe: Registry and VISTA Solved Pin
Bram van Kampen13-Mar-08 11:34
Bram van Kampen13-Mar-08 11:34 
GeneralRe: Registry and VISTA Solved Pin
Mark Salsbery13-Mar-08 11:42
Mark Salsbery13-Mar-08 11:42 
Generalspecifying object type at compile time Pin
act_x28-Feb-08 12:50
act_x28-Feb-08 12:50 
given a class heirarch where

A is the base class and B , C are derived classes .

Now I want to implement something like an object factory externally where I want to automatically create an object of the appropriate type . For this I define a struct with the definition ( pardon me for the pseudo code as part of the problem is with usage)

typedef struct 
{ 
  int code ;
  reference_to_type_creator ; 
}OBJ_TYPE ; 

OBJ_TYPE objTable[] = 
{ objA_code  , < reference to create an object of type A > } , 
{ objB_code  , < reference to create an object of type B > } , 
{ objC_code  , < reference to create an object of type C > } , 

{ -1 , NULL } 
such that I can use this table in a function that processes random object entries

ProcessObject( int objCode  )
{
for (int i=0;objTable[i].code!=-1;i++)
{
    if( objCode == objTable[i].code)
   {
      A *a = objTable[i].reference_to_type_creator     // Unsure about how this could work 
      a->Foo()
   }
}
}
I was unclear as to how this reference would be specified in the struct array above and its usage.
Help is appreciated



}

Engineering is the effort !

GeneralRe: specifying object type at compile time Pin
Chris Losinger28-Feb-08 15:54
professionalChris Losinger28-Feb-08 15:54 
GeneralDialog Box Refresh Pin
RomTibi28-Feb-08 5:50
RomTibi28-Feb-08 5:50 
GeneralRe: Dialog Box Refresh Pin
led mike28-Feb-08 5:58
led mike28-Feb-08 5:58 
GeneralRe: Dialog Box Refresh Pin
RomTibi29-Feb-08 6:20
RomTibi29-Feb-08 6:20 
GeneralRe: Dialog Box Refresh Pin
led mike29-Feb-08 6:32
led mike29-Feb-08 6:32 
GeneralRe: Dialog Box Refresh Pin
RomTibi29-Feb-08 7:35
RomTibi29-Feb-08 7:35 
GeneralRe: Dialog Box Refresh Pin
RomTibi1-Mar-08 22:23
RomTibi1-Mar-08 22:23 
GeneralRe: Dialog Box Refresh Pin
led mike2-Mar-08 14:54
led mike2-Mar-08 14:54 
GeneralRe: Dialog Box Refresh Pin
RomTibi4-Mar-08 5:04
RomTibi4-Mar-08 5:04 
GeneralRe: Dialog Box Refresh Pin
Michael Schubert28-Feb-08 7:03
Michael Schubert28-Feb-08 7:03 
GeneralRe: Dialog Box Refresh Pin
RomTibi29-Feb-08 6:22
RomTibi29-Feb-08 6:22 
GeneralRe: Dialog Box Refresh Pin
Bram van Kampen28-Feb-08 12:57
Bram van Kampen28-Feb-08 12:57 
GeneralRe: Dialog Box Refresh Pin
RomTibi29-Feb-08 6:22
RomTibi29-Feb-08 6:22 
GeneralRe: Dialog Box Refresh Pin
Michael Dunn28-Feb-08 13:08
sitebuilderMichael Dunn28-Feb-08 13:08 
GeneralRe: Dialog Box Refresh Pin
RomTibi29-Feb-08 6:23
RomTibi29-Feb-08 6:23 
GeneralGetting a base word from an extended word. [Solved] Pin
Kiss The Kipper28-Feb-08 5:49
Kiss The Kipper28-Feb-08 5:49 
GeneralRe: Getting a base word from an extended word. Pin
led mike28-Feb-08 6:39
led mike28-Feb-08 6:39 

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.