home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky gnu.g++.help:1180 comp.lang.c++:13229
- Path: sparky!uunet!news.claremont.edu!elroy.jpl.nasa.gov!ames!network.ucsd.edu!ucsbcsl!foxtrot.ccmrc.ucsb.edu
- From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
- Newsgroups: gnu.g++.help,comp.lang.c++
- Subject: What does this compiler error mean?
- Message-ID: <5599@ucsbcsl.ucsb.edu>
- Date: 2 Sep 92 21:40:59 GMT
- Sender: root@ucsbcsl.ucsb.edu
- Reply-To: doug@foxtrot.ccmrc.ucsb.edu
- Followup-To: gnu.g++.help
- Distribution: usa
- Lines: 62
-
- What is this error, which appears only when using the -Woverloaded-virtual
- flag, telling me about my virtual functions? In each derived class, the
- virtual function sampleRate() is declared as returning an int, and accepting no
- arguments. LPCHeader, FFTHeader, and EnvelopeHeader are all derived from
- Header. The Header class itself contains no member function sampleRate; it is
- virtual in the three derived classes to allow further derivations of those
- classes.
-
- Header.h:154: conflicting specification deriving virtual function `int
- LPCHeader::sampleRate ()'
- Header.h:198: conflicting specification deriving virtual function `int
- FFTHeader::sampleRate ()'
- Header.h:234: conflicting specification deriving virtual function `int
- EnvelopeHeader::sampleRate ()'
-
- Here is a portion of the header file:
-
- class Header : public Resource {
- protected:
- int magic_number;
- int data_offset;
- int data_size;
- DataType data_type;
- int nchans;
- char *comment;
- public:
- ..
- };
-
- class LPCHeader : public Header {
- protected:
- int npoles;
- double framerate;
- int samprate;
- double dur;
- public:
- ..
- virtual int sampleRate() { return samprate; }
- ..
- };
-
- class FFTHeader : public Header {
- protected:
- int mode;
- int samprate;
- int npoints;
- public:
- ..
- virtual int sampleRate() { return samprate; }
- ..
- };
-
- I know that I could extract out an intermediate abstract class containing the
- common data and interface, but for the small amount of overlap, I dodnt bother.
-
- Thanks in advance.
-
- --
- Douglas Scott (805)893-8352
- Center for Computer Music Research and Composition
- University of California, Santa Barbara
- Internet: (NeXTMail ok) <doug@foxtrot.ccmrc.ucsb.edu>
-