home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / g / help / 1180 < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.1 KB  |  76 lines

  1. Xref: sparky gnu.g++.help:1180 comp.lang.c++:13229
  2. Path: sparky!uunet!news.claremont.edu!elroy.jpl.nasa.gov!ames!network.ucsd.edu!ucsbcsl!foxtrot.ccmrc.ucsb.edu
  3. From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
  4. Newsgroups: gnu.g++.help,comp.lang.c++
  5. Subject: What does this compiler error mean?
  6. Message-ID: <5599@ucsbcsl.ucsb.edu>
  7. Date: 2 Sep 92 21:40:59 GMT
  8. Sender: root@ucsbcsl.ucsb.edu
  9. Reply-To: doug@foxtrot.ccmrc.ucsb.edu
  10. Followup-To: gnu.g++.help
  11. Distribution: usa
  12. Lines: 62
  13.  
  14. What is this error, which appears only when using the -Woverloaded-virtual  
  15. flag, telling me about my virtual functions?  In each derived class, the  
  16. virtual function sampleRate() is declared as returning an int, and accepting no  
  17. arguments. LPCHeader, FFTHeader, and EnvelopeHeader are all derived from  
  18. Header.  The Header class itself contains no member function sampleRate; it is  
  19. virtual in the three derived classes to allow further derivations of those  
  20. classes.
  21.  
  22. Header.h:154: conflicting specification deriving virtual function `int   
  23. LPCHeader::sampleRate ()'
  24. Header.h:198: conflicting specification deriving virtual function `int   
  25. FFTHeader::sampleRate ()'
  26. Header.h:234: conflicting specification deriving virtual function `int   
  27. EnvelopeHeader::sampleRate ()'
  28.  
  29. Here is a portion of the header file:
  30.  
  31. class Header : public Resource {
  32. protected:
  33.     int magic_number;
  34.     int data_offset;
  35.     int data_size;
  36.     DataType data_type;
  37.     int nchans;
  38.     char *comment;
  39. public:
  40. ..
  41. };
  42.  
  43. class LPCHeader : public Header {
  44. protected:
  45.     int npoles;
  46.     double framerate;
  47.     int samprate;
  48.     double dur;
  49. public:
  50. ..
  51.     virtual int sampleRate() { return samprate; }
  52. ..
  53. };
  54.  
  55. class FFTHeader : public Header {
  56. protected:
  57.     int mode;
  58.     int samprate;
  59.     int npoints;
  60. public:
  61. ..
  62.     virtual int sampleRate() { return samprate; }
  63. ..
  64. };
  65.  
  66. I know that I could extract out an intermediate abstract class containing the  
  67. common data and interface, but for the small amount of overlap, I dodnt bother.
  68.  
  69. Thanks in advance.
  70.  
  71. --
  72. Douglas Scott                              (805)893-8352
  73. Center for Computer Music Research and Composition
  74. University of California, Santa Barbara
  75. Internet: (NeXTMail ok)   <doug@foxtrot.ccmrc.ucsb.edu>
  76.