C++ question

Scott Wheeler wheeler at kde.org
Wed Sep 25 12:39:53 BST 2002


>From Secion 15.4.3 of The Holy Book (tm):   
   
Pretty much, no.  [my paraphrase]  :-)   
   
Constructors are called from the bottem of the class hierarch to the top, so   
at that point, your instance of "class A" will just be class A (not some  
arbitrary subclass), and even if you override func()'s implementation in a  
subclass, in the constructor (of the baseclass "A") you will be calling a pure  
virtual function.  
  
-Scott  
   
Quoting Michael Goffioul <goffioul at imec.be>:   
   
> Can I call a pure virtual function in the constructor of the abstract   
> class? That is   
>    
> class A   
> {   
> public:   
>    A() { func(); }   
>    virtual void func() = 0;   
> };   
>    
> Michael.   
    




More information about the kde-core-devel mailing list