[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Odd inheritance
From:       Cristian Tibirna <tibirna () kde ! org>
Date:       2000-10-25 21:25:48
[Download RAW message or body]

On Wednesday 25 October 2000 12:48, Lubos Lunak wrote:
> > IIRC It is illegal to call virtual functions in contructors
> > anyway, so you should get a compile time error.
>
>  It's allowed and it has a defined behaviour ( which just differs from what
> people would expect ). If you have 'class B : public A' , and a virtual
> method foo() is called in constructor/destructor in class A, A::foo() will
> be called ( or if there is no foo() in A then the inherited one will be
> called ). B::foo() won't be called, because at that time, B doesn't really
> exist.

Perfectly true. Pay attention tough, GCC (EGCS) has a severe bug that makes 
binaries crash when this feature is used.

CT

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic