POV-Ray : Newsgroups : povray.off-topic : Wahahahaha! : Re: Wahahahaha! Server Time
11 Oct 2024 17:47:06 EDT (-0400)
  Re: Wahahahaha!  
From: Warp
Date: 11 Nov 2007 18:06:46
Message: <47378b06@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> >   The problem with calling a pure virtual function in the base class
> > constructor is that the derived class has yet not been initialized and
> > thus calling a derived class function implementation could cause undefined
> > behavior because it's not constructed.

> You mean, undefined behavior as opposed to a core dump? ;-)

  Yes, undefined behavior. It could work like a charm, or it could cause
a segmentation fault. (The latter may easily happen if, for example, the
function in the derived class accesses eg. a string, which obviously has
not yet been initialized and contains garbage.)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.