C++ overloaded virtual function

Joe Nosay superbisquit at gmail.com
Fri Dec 20 22:10:12 UTC 2013


On Fri, Dec 20, 2013 at 12:52 PM, Alan Somers <asomers at freebsd.org> wrote:

> On Fri, Dec 20, 2013 at 12:52 AM, Joe Nosay <superbisquit at gmail.com>
> wrote:
> >
> /usr/home/raspycat/traverso/work/traverso-0.49.2/src/engine/Driver.h:49:14:
> > note: hidden overloaded virtual function 'Driver::setup' declared
> > here: different number of parameters (3 vs 4)
> >         virtual int setup(bool capture=true, bool playback=true, const
> > QString& cardDevice="none"
> >
> > Three = and one &, the last being the odd man out. Both spacing and
> > removing the & still results in an error.
> >
> > Clang++ is expecting an absolute value such as the other three.
> >
> > How do I compensate for the & to have the same value type as =?
>
> Your prototype calls the QString constructor within the prototype
> itself.  I don't know if that's illegal, but it's certainly weird.  I
> would try creating a global variable for "none", and reference that
> object in the prototype, like this:
>
> Driver.h:
>
> QString NoneQString;
> virtual int setup(bool capture=true, bool playback=true, const
> QString& cardDevice=NoneQString);
>
> Driver.cc
> QString NoneQString("none");
>
> -Alan
>
> > _______________________________________________
> > freebsd-hackers at freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > To unsubscribe, send any mail to "
> freebsd-hackers-unsubscribe at freebsd.org"
>


New error::

/usr/home/raspycat/traverso/work/traverso-0.49.2/src/engine/Driver.h:50:85:
error:
      invalid use of non-static data member 'NoneQString'
  ...bool playback=true, const QString& cardDevice=NoneQString);


More information about the freebsd-hackers mailing list