TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Steve Hier
from: Kelly Schrock
date: 1994-12-23 01:18:00
subject: virtual functions

SH> Well, first of all, in order for a virtual function to "function"
SH> (ha) correctly, both the base class and the derived class must have
SH> it defined as a virtual function......

Really? I never heard that...

SH> Assuming that you meant to say both of those functions were
SH> virtual, then I would begin to suspect a stack / heap problem --
SH> that is (once again), if you indeed meant to declare both of those
SH> as virtual AND it works in a "small" program and crashes in a larger
SH> program.....

As it turns out, casting the derived class object's address to a
pointer to the base class is what the problem was. I've never seen it
before, but it turned the contents of the pointer to junk. The base
class I was trying to cast it to was a virtual base class, and off the
top of my head , i'm thinking this could have been part of the problem.

Thanks,
Kelly

___
 X KWQ/2 1.2g NR X Look Ma, I'm a *Beta Tester*: KWQ Mail/2 for OS/2 v2.X!

--- Maximus/2 2.02
* Origin: OS/2 Shareware BBS, Fairfax, VA: 703-385-4325 (1:109/347)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1
@PATH: 109/347 2 7 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.