Article View: comp.lang.c++.leda
Article #118Re: Mapping of Name Tag to a Method Name in C++
From: Emmanuel Nanchen
Date: Thu, 05 Oct 1995 07:19
Date: Thu, 05 Oct 1995 07:19
27 lines
979 bytes
979 bytes
Hello,
I'm not sure I fully understood what you meant, but there is a way
to choose a method: create a table of pointer to function:
Pointer_to_my_function table[3];
enum Choice {Default = 0, alg1, alg2};
Choice choice = Default;
Pointer_to_my_function pointer = table[choice];
/* to call */
table[choice](arguments);
With this way of doing, all methods must have the same arguments type :-(
but its easy to implement, and to modify, add, etc.
Hope this helps
Emmanuel
Ps check the syntax, I'm not quite sure
nanchen@divsun.unige.ch
Technical Details
Message-ID:
<1995Oct5.071947.18707@news.unige.ch>Path:
arc1-ca.pugleaf.net!news.unige.ch!usenetReferences:
<44up9m$1au@aadt.sdt.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.c++.leda Path: arc1-ca.pugleaf.net!news.unige.ch!usenet From: nanchen@cui.unige.ch (Emmanuel Nanchen) Subject: Re: Mapping of Name Tag to a Method Name in C++ Message-ID: <1995Oct5.071947.18707@news.unige.ch> Sender: usenet@news.unige.ch Reply-To: nanchen@cui.unige.ch Organization: University of Geneva, Switzerland References: <44up9m$1au@aadt.sdt.com> Date: Thu, 5 Oct 1995 07:19:47 GMT