Click here to Skip to main content
15,905,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dll's with win32 project Pin
John R. Shaw22-May-03 8:22
John R. Shaw22-May-03 8:22 
GeneralRe: Dll's with win32 project Pin
Chris Richardson22-May-03 17:35
Chris Richardson22-May-03 17:35 
GeneralRe: Dll's with win32 project Pin
Mazdak22-May-03 22:59
Mazdak22-May-03 22:59 
GeneralNeed help migrating to Visual Studio .NET Pin
ElizabethC22-May-03 6:31
ElizabethC22-May-03 6:31 
QuestionHow to create a shortcut file? Pin
Emiliano22-May-03 6:20
Emiliano22-May-03 6:20 
AnswerRe: How to create a shortcut file? Pin
AlexO22-May-03 6:37
AlexO22-May-03 6:37 
AnswerRe: How to create a shortcut file? Pin
David Crow22-May-03 6:44
David Crow22-May-03 6:44 
Questiontemplated Factory Pattern ? Pin
Maximilien22-May-03 6:13
Maximilien22-May-03 6:13 
I have a series of menu callbacks that do the samething, create an object associated with the menu; for example, menu is create rectangle, the callback will create a rectanle, if menu is circle, the callback will create a circle;

Each callback is similar, except for the type of the object to create; all objects have a common base class.

Is there a pattern that I can use to remove all "similar" code into one function?

I'd like to be able to do something like :

void MyClass::OnRectangle()
{
 MyFunction( ClassName );
}
void MyClass::MyFunction( /* something ClassName */ )
{
 new ClassName  
}


Where ClassName is the name of the class, not an instance; I need the class because I'm doing some dynamic_cast with it.

The question could also be, can I pass a class as a parameter to a function ?

I could do a simple factory pattern, but that would only move the "problem" somewhere else.

Thanks.




Maximilien Lincourt
For success one must aquire one's self
AnswerRe: templated Factory Pattern ? Pin
Chris Losinger22-May-03 7:21
professionalChris Losinger22-May-03 7:21 
GeneralRe: templated Factory Pattern ? Pin
Maximilien22-May-03 7:29
Maximilien22-May-03 7:29 
GeneralAny electonic book about Driver & API Hook Pin
Fad B22-May-03 5:01
Fad B22-May-03 5:01 
GeneralRe: Any electonic book about Driver & API Hook Pin
Martin Cook22-May-03 6:14
professionalMartin Cook22-May-03 6:14 
GeneralRe: Any electonic book about Driver & API Hook Pin
David Crow22-May-03 6:45
David Crow22-May-03 6:45 
GeneralOrdinal not found Pin
JensB22-May-03 4:55
JensB22-May-03 4:55 
GeneralRe: Ordinal not found Pin
valikac22-May-03 5:02
valikac22-May-03 5:02 
GeneralRe: Ordinal not found Pin
AlexO22-May-03 5:03
AlexO22-May-03 5:03 
GeneralRe: Ordinal not found Pin
JensB22-May-03 6:09
JensB22-May-03 6:09 
GeneralRe: Ordinal not found Pin
David Crow22-May-03 6:47
David Crow22-May-03 6:47 
GeneralRe: Ordinal not found Pin
David Crow22-May-03 6:50
David Crow22-May-03 6:50 
GeneralRe: Ordinal not found Pin
JensB22-May-03 6:59
JensB22-May-03 6:59 
Questionkill process by name ? Pin
bob_brown_200022-May-03 4:32
bob_brown_200022-May-03 4:32 
AnswerRe: kill process by name ? Pin
valikac22-May-03 5:08
valikac22-May-03 5:08 
GeneralRe: kill process by name ? Pin
bob_brown_200022-May-03 5:39
bob_brown_200022-May-03 5:39 
Generalmember function as callback function problem Pin
yccheok22-May-03 4:31
yccheok22-May-03 4:31 
GeneralRe: member function as callback function problem Pin
AlexO22-May-03 5:00
AlexO22-May-03 5: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.