Hi,
I stumbled across the following error
foo.cc: In function `int main()':
foo.cc:15: error: no matching function for call to `Bar::foo(int)'
foo.cc:9: error: candidates are: void Bar::foo(int, int)
where foo.cc is
struct Foo
{
int i ;
void foo(int i) { this->i = i ; }
} ;
struct Bar : public Foo
{
void foo(int j, int k) { this->i = j * k ; }
} ;
int main()
{
Bar bar ;
bar.foo(2) ;
bar.foo(3, 4) ;
return 0 ;
}
So Foo::foo(int) is no longer accessible in the derived class Bar. --
Though it is accessible if Bar has no foo(int, int) method. -- Is this
covered by the standard, and if so why?
thx & rgds, Steffen g++ -v
Reading specs from
/usr/local/gcc-3.3.1/lib/gcc-lib/alphaev68-dec-osf5.1/3.3.1/specs
Configured with: ../gcc-3.3.1/configure --prefix=/usr/local/gcc-3.3.1
--disable-shared
Thread model: single
gcc version 3.3.1 12 1385
Steffen wrote: Hi,
[snip] int main() { Bar bar ; bar.foo(2) ; bar.foo(3, 4) ; return 0 ; }
So Foo::foo(int) is no longer accessible in the derived class Bar. -- Though it is accessible if Bar has no foo(int, int) method. -- Is this covered by the standard, and if so why?
Yes. It is called 'function hiding'.
Please serach the groups archive at www.google.com for 'function hiding'.
--
Karl Heinz Buchegger kb******@gascad .at
Thx for the quick answer! -- Though I have to get used to the idea
behind.
"Steffen" <st****@gmx.d e> wrote in message news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Hi,
I stumbled across the following error
foo.cc: In function `int main()': foo.cc:15: error: no matching function for call to `Bar::foo(int)' foo.cc:9: error: candidates are: void Bar::foo(int, int)
where foo.cc is
struct Foo { int i ; void foo(int i) { this->i = i ; } } ;
struct Bar : public Foo {
using Foo::foo;
// C++ FAQ LITE, http://www.parashift.com/c++-faq-lit...ce.html#faq-23, Question 23.7
void foo(int j, int k) { this->i = j * k ; } } ;
int main() { Bar bar ; bar.foo(2) ; bar.foo(3, 4) ; return 0 ; }
So Foo::foo(int) is no longer accessible in the derived class Bar. -- Though it is accessible if Bar has no foo(int, int) method. -- Is this covered by the standard, and if so why?
thx & rgds, Steffen
g++ -v Reading specs from /usr/local/gcc-3.3.1/lib/gcc-lib/alphaev68-dec-osf5.1/3.3.1/specs Configured with: ../gcc-3.3.1/configure --prefix=/usr/local/gcc-3.3.1 --disable-shared Thread model: single gcc version 3.3.1
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com http://mathforum.org/library/view/10978.html http://sourceforge.net/users/alexvn
Hi Steffen
Also go through the book " Effective C++ by Scott Mayer " .It will
explain you why this behaviour is there in standred .
Regards
Raj
Steffen wrote: Thx for the quick answer! -- Though I have to get used to the idea behind.
Please quote a relevant portion of the previous message in your
replies. To do so from Google, click "show options" and select the
Reply shown in the expanded header.
Brian
Rajan wrote: Hi Steffen Also go through the book " Effective C++ by Scott Mayer " .It will explain you why this behaviour is there in standred .
Please quote a relevant portion of the previous message in your
replies. To do so from Google, click "show options" and select the
Reply shown in the expanded header.
Brian
Default User wrote: Steffen wrote:
Thx for the quick answer! -- Though I have to get used to the idea behind. Please quote a relevant portion of the previous message in your replies. To do so from Google, click "show options" and select the Reply shown in the expanded header.
What would be the "relevant portion"? The two timestamps from the
original post and the reply? Try limit your requests about quoting
of relevant portions to something that actually makes sense, will you?
V
Victor Bazarov wrote: Default User wrote: Steffen wrote:
Thx for the quick answer! -- Though I have to get used to the idea behind.
Please quote a relevant portion of the previous message in your replies. To do so from Google, click "show options" and select the Reply shown in the expanded header.
What would be the "relevant portion"? The two timestamps from the original post and the reply?
At the very least, the attribution, so that we know which "quick
answer" the person is talking about.
Try limit your requests about quoting of relevant portions to something that actually makes sense, will you?
It's then a good thing that this is one of those cases.
With the spreading use of Google, people need to be trained to use the
proper Reply. Nitpicking my attempts to do so sure doesn't help.
Brian
Default User wrote: [...] With the spreading use of Google, people need to be trained to use the proper Reply. Nitpicking my attempts to do so sure doesn't help.
Perhaps you should start another forum, like comp.google.how to and give
your advice there? Here it looks more and more like the noise we want to
avoid. I'll happily redirect people to such newsgroup (and we can add
a mention of it in the FAQ) if it existed... Or maybe you could appeal to
Google so that they fix their reply mechanism... In any case, posting
here about any _particular_ news reading software and how to use it is
just like posting about any particular compiler and its command-line
switches, don't you think?
V This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Clark Nu |
last post by:
It seems that when I define a fuction,I can set a default value to some of
the peremeters.When I call the fuction without some of them,the fuction will
use the default value automaticlly then continue to work.But I'v fogot how
to use,even I'v fogot whether I can use it in C# or not.
Help me.
|
by: Ray Mitchell |
last post by:
Hello,
I am opening a modal dialog in the standard way using something like:
....all the standard setup stuff...
dlg.ShowDialog();
I need the dialog object to be able to access some of the methods back in
the object that created it (the code above). Is there some attribute,
method, or whatever within the dialog object that provides such access or do
|
by: Le, Thanh-Nhan |
last post by:
Hi,
I am a beginner in .NET.
I am creating a new project. At begin I created this project with a form,
then a class."start"
I want to use class "start" as start point for this program. In this class I
wrote:
static void Main()
|
by: dale zhang |
last post by:
Hi groups,
Can anyone give me the equivalent C# sharp code for this VB.ET code,
:: VB.NET ::
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles MyBase.Load
'This event routine in the loginCheck user control fires when the
|
by: CeyloR |
last post by:
Can anyone tell me what the "c" means in a statement like this:
strTest = New String(" "c,10)
I know the 10 in above example stands for the maxlength of characters
in the string. Is it posible to skip this maxlength?
I'm trying to open a textfile an put it into a string, and therefor I
just want to read the whole textfile til EOF.
| |
by: Pierre Quentel |
last post by:
Hi all,
In some program I was testing if a variable was a boolean, with this
test : if v in
My script didn't work in some cases and I eventually found that for v =
0 the test returned True
So I changed my test for the obvious "if type(v) is bool", but I still
find it confusing that "0 in " returns True
|
by: Roy |
last post by:
From the MS site:
NAME: ClientScriptManager.GetCallbackEventReference (Control, String,
String, String)
DESCRIPTION: Obtains a reference to a client-side function that, when
invoked, initiates a client call back to a server-side event. The
client-side function for this overloaded method includes a specified
control, argument, client-side script, and context.
What is "context?"
|
by: Oenone |
last post by:
In our applications, we use the special value of DateTime.MinValue to
represent "null dates" throughout all our code. We recently ran into an
issue where we wanted an optional date parameter for a procedure. We weren't
able to declare it with DateTime.MinValue as its default value, as MinValue
is a read-only property rather than a constant. To work around, we had to
use a "magic date" that we checked for later on. I was never very happy...
|
by: John Goche |
last post by:
Hello,
Could anyone please provide with some information on the
C++ overloaded cast operator and in which circumstances
this might be useful? I have consulted several references
but found no information on the uses of this operator.
Thanks,
JG
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |