Re: Am I inherited?
"Mike - EMAIL IGNORED" <m_d_berger_1900@yahoo.com> skrev i meddelandet
news:pan.2006.07.22.02.06.39.355911@yahoo.com...
[...]
For now, if a virtual class name member function is one solution,
as you
have indicated, then a version of the same idea using built-in
support
is the typeid operator.
I just tried typeid. It appears that it doesn't know where I
would like to know: in the constructor.
If you need to know something in a constructor, that something should
generally be a parameter to that constructor. You could add a
protected constructor, that the subclasses can call. Then at least you
know where that call comes from.
But, as Alf said, in a base class you generally don't want to know
your subclasses. They should take care of themselves.
FYI, the situation is a hierarchy of complex mathematical
operations, each one in its own class. Most of the classes
can function alone or in concert with others. The sequence
of events is controlled by ctor of the most inherited class.
The data for all classes are mostly the same type, voluminous,
and kept protected in a base class. Virtual inheritance is
used. The most inherited class must recognize itself in the
ctor.
And we all wonder why. :-)
There are, of course, other designs,
Right!
but this provides
simplicity for the unsophisticated user and ease of expansion
as other mathematical procedures and interactions are developed.
To me it looks more like the "ease of expansion" is not at all obvious
here, if the base class needs to know all expansions. But, what do I
know?
Bo Persson