On 7/7/2011 7:10 AM, RayLopez99 wrote:
> On Jul 6, 10:01 am, VijayRama<vijay3...@gmail.com> wrote:
>> Hi,
>>
>> How to avoid deriving a class to more than one class?
>> For example consider I have a Class A ( base class) which is derived
>> by Class B. Now if I try to derive Class A to Class C it shouldn't be
>> allowed. How can I do this?
>>
>> class A
>> {}
>>
>> class B:class A
>> {}
>>
>> class C: class A // deriving class A should not be allowed
>> {
>>
>> }
>
> The compiler will stop you if your classes are circular.
True, but that is not the case here.
> Just make a mental note not to do that when you code. If you mean
> during run time, then simply don't make C depend on A--presto! you
> are done.
That is a simple solution that may or may not work.
Arne
|