home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / msdos / programm / 12527 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.2 KB  |  50 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!ukma!gatech!news.byu.edu!ux1!fcom.cc.utah.edu!dave
  3. From: dave@news.ccutah.edu (Dave Martin)
  4. Subject: BC++ 3.0 vs 3.1 bug fixed?
  5. Message-ID: <1993Jan28.151015.11739@fcom.cc.utah.edu>
  6. Sender: news@fcom.cc.utah.edu
  7. Reply-To: dave@csulx.weber.edu
  8. Organization: University of Utah Computer Center
  9. X-Newsreader: Tin 1.1 PL3
  10. Date: Thu, 28 Jan 93 15:10:15 GMT
  11. Lines: 37
  12.  
  13. I am having a problem in BC++3.0 with virtual functions.
  14. It was compiled huge model with and without optimization, and various
  15. other flags is dos mode.
  16.  
  17. Basically, the wrong function is being invoked.
  18. my program is structured like this:
  19.  
  20. class base
  21. {
  22. ..
  23. virtual somefunc()
  24. };
  25.  
  26. class a : public class base
  27. {
  28. ..
  29. virtual unrelatedfunc()
  30. };
  31.  
  32. class b: public class base,public class someotherbase
  33. {
  34. ..
  35. virtual somefunc()
  36. };
  37.  
  38. b someb;
  39. someb->somefunc()  actually calls unrelatedfunc in class a.
  40.  
  41. I verified this with the debugger, and by putting output statements
  42. just before the call to someb->somefunc(), and in unrelatedfunc().
  43. needless to say, the program goes nuts because the context is totally
  44. wrong for unrelatedfunc().
  45.  
  46. Is this a known problem? is it fixed in 3.1?
  47.  
  48. dave@csulx.weber.edu
  49.  
  50.