* Mike - EMAIL IGNORED:
> On Sat, 22 Jul 2006 02:28:41 +0200, Alf P. Steinbach wrote:
>
>> * Mike - EMAIL IGNORED:
>>> On Sat, 22 Jul 2006 00:42:59 +0200, Alf P. Steinbach wrote:
>>>
>>>> * Mike - EMAIL IGNORED:
>>>>> Within class MyClass, I can think of two ways
>>>>> to tell if MyClass is inherited in a particular
>>>>> use:
>>>>>
>>>>> 1. pass an appropriate bool in the ctor args;
>>>>>
>>>>> 2. use a virtual method that returns, for
>>>>> example, a siring containing the class name.
>>>>>
>>>>> Is there a better way?
>>>> Design the class so it doesn't need that knowledge.
>>> That is often a good idea; but in this case, it is not.
>> That would be interesting, if true. However, I'm disinclined to believe
>> that claim without some concrete evidence. Please post a small example
>> that compiles, or where the compilation error illustrates the problem.
>
> Off point: the question is how, not whether to do it. There is no error.
I think that protest means you know your design is triple UnGood, and
just want a quick and dirty kludge.
Which will hopefully give an endless nightmare of problems so that you
learn to do things properly.
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.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?