[linux-audio-dev] A C++ question

Andy Schmeder andy at a2hd.com
Thu Apr 17 18:27:01 UTC 2003


<quote who="Nick Tsocanos">
> Sometimes I might make a class, and inherit it from another. Or, the
> class just has virtual functions in it ( I am planning to derive others
> from it). In any case, I am trying to access a virtual function in an
> instantiated instance at runtime, and when I do, the program crashes.
...

You don't give much detail, but here my guess:

Methods of parent classes (other than the constructor) are not available
from within the constructor of derived classes.  The object is not
'completed' until after the constructor exits.

See B. Stroustrup's "The C++ Programming Language" for the gritty details.

Dynamic runtime languages (e.g. Python) do not have this problem...  so it
might be a bit suprising depending on your background.

--aws

mailto:andy*a2hd,com
http://www.a2hd.com/




More information about the Linux-audio-dev mailing list