home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13131 < prev    next >
Encoding:
Text File  |  1992-08-31  |  1.2 KB  |  57 lines

  1. Organization: Junior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA
  2. Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!sm86+
  3. Newsgroups: comp.lang.c++
  4. Message-ID: <seckQ7200awJAJJJ0i@andrew.cmu.edu>
  5. Date: Tue,  1 Sep 1992 02:00:39 -0400 
  6. From: Stefan Monnier <sm86+@andrew.cmu.edu>
  7. Subject: Overloading (method redefining)
  8. Lines: 47
  9.  
  10.  
  11. Although I'm already used to OOP, I'm new to C++
  12.  
  13. Whiel experimenting with a silly example, I have a little problem when
  14. I want to redefine a method in a subclass:
  15.  
  16. class bidon1 {
  17. public:
  18.   void Fonction();
  19. };
  20.  
  21. void bidon1::Fonction()
  22. {
  23.     // do something not too silly
  24. };
  25.  
  26. class bidon2: public bidon1 {
  27.   int a,b;
  28. public:
  29.   void Fonction();
  30. };
  31.  
  32. void bidon2::Fonction()
  33. {
  34.     printf(...,a,b);
  35. };
  36.  
  37.  
  38. The loader always teels me: Fonction__8bidon1: multiply defined
  39.  
  40. I tried to put a 'virtual' in front of void in bidon1,
  41. I tried to put a '-fall-virtual' on the command line (I use G++)
  42. Always the same result!
  43.  
  44. What do I need (well, maybe I just need a book) ?
  45.  
  46.     Stefan Monnier
  47.  
  48.  
  49. -----------------------------------------------------
  50. -- On the average, people seem to be acting normal --
  51. -----------------------------------------------------
  52.  
  53.  
  54.  
  55.  
  56.  
  57.