Re: help with automatic code generation
- From: Willem <willem@xxxxxxxx>
- Date: Tue, 30 Jan 2007 16:55:54 +0000 (UTC)
JoshforRefugee wrote:
) I heard that we can do automatic code generation using macros, but not
) sure how can I pursue this. Here is my problem.
)
) In my env, I have class A,B and C. All of them has constructors, and
) few common methods, like reset, and execute.
)
) now my env(main) class actually is where I am creating this objects.
) in .h
) A myA;
) B myB;
) C myC;
)
) and later I am calling methods in my .C file
) myA.reset();
) myB.reset();
) myC.reset();
) myA.execute();
) .....
) myC.execute();
Well, the object-oriented approach would be to have all of those objects
implement/inherit a common interface, with the calls reset, execute, etc.
Then you can put all your objects in a group (array, bag, whatever) and
call 'reset' and 'execute' on all of them. Then to add a new one, you only
need to change the bit of code where they're added to the group.
The exact details on how to do this depend on the language, and I'm not too
well-versed in C++ to know how exactly to do it there.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.
- Follow-Ups:
- Re: help with automatic code generation
- From: JoshforRefugee
- Re: help with automatic code generation
- References:
- help with automatic code generation
- From: JoshforRefugee
- help with automatic code generation
- Prev by Date: Bron-Kerbosh algorithm for clique detection
- Next by Date: Re: Bron-Kerbosh algorithm for clique detection
- Previous by thread: help with automatic code generation
- Next by thread: Re: help with automatic code generation
- Index(es):
Relevant Pages
|