Article View: pl.comp.lang.c
Article #309685Re: Dziedziczcenie i metody
From: radoslaw
Date: Thu, 07 Jun 2018 13:39
Date: Thu, 07 Jun 2018 13:39
30 lines
2402 bytes
2402 bytes
W dniu czwartek, 7 czerwca 2018 15:16:29 UTC+2 użytkownik Borneq napisał:
> W dniu 07.06.2018 o 11:02, r... pisze:
> > Witam,
> >
> > Mam klasę bazową A:
> > class A {
> > bool send() { return send(0); };
> > virtual bool send(int flags);
> > }
> > oraz klasę pochodną B:
> > class B: public A {
> > bool send(int flags);
> > }
> > chciałbym teraz móc skorzystać z B.send() ale kompilator wywala:
> > error: no matching function for call to ‘B::send()’
> > b.send();
> > ^
> > note: candidate: virtual bool B::send(int)
> > obejście w postaci zdefiniowania B::send() jakoś mi nie pasuje. Przyjmę wszelaką krytykę i pomoc, także query do google.
> >
> Send z B przykrywa wirtualną, trzeba
B::send(int) jest tam specjalnie aby dostarczyć inną implementację metody send().
> b.A::send();
Ale to wymaga znajomości klasy podstawowej poza implementacja klasy co jest sprzeczne z ideą dziedziczenia.
> - sprawdzone na VStudio
Dzięki.
Technical Details
Message-ID:
<67735517-9182-4882-88ba-475475884d14@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h2-v6no3116308qtp.0!news-out.google.com!k3-v6ni587qtj.0!nntp.google.com!h2-v6no3116306qtp.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mailReferences:
<342f89bb-b3d4-4c87-9dd7-97a572d63ab0@googlegroups.com> <pfbb7c$9cm$1@node1.news.atman.pl>Show Full Headers
Complete Article Headers
X-Received: by 2002:a0c:f70f:: with SMTP id w15-v6mr911007qvn.62.1528378791457; Thu, 07 Jun 2018 06:39:51 -0700 (PDT) X-Received: by 2002:a81:3487:: with SMTP id b129-v6mr71823ywa.13.1528378791172; Thu, 07 Jun 2018 06:39:51 -0700 (PDT) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h2-v6no3116308qtp.0!news-out.google.com!k3-v6ni587qtj.0!nntp.google.com!h2-v6no3116306qtp.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: pl.comp.lang.c Date: Thu, 7 Jun 2018 06:39:50 -0700 (PDT) In-Reply-To: <pfbb7c$9cm$1@node1.news.atman.pl> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.174.26.203; posting-account=XENjyAkAAACMiwFCilkQ6IR7gD6eX5mJ NNTP-Posting-Host: 93.174.26.203 References: <342f89bb-b3d4-4c87-9dd7-97a572d63ab0@googlegroups.com> <pfbb7c$9cm$1@node1.news.atman.pl> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <67735517-9182-4882-88ba-475475884d14@googlegroups.com> Subject: Re: Dziedziczcenie i metody From: radoslaw@korzeniewski.net Injection-Date: Thu, 07 Jun 2018 13:39:51 +0000 Lines: 35 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit