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 1360
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.de> wrote in message news:11**********************@o13g2000cwo.googlegr oups.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.howto 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
* Victor Bazarov: 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.
... Here it looks more and more like the noise we want to avoid.
Ah, I think you're the one making the noise now. ;-)
Concise guidance on posting is very common and generally works well
as long as people don't start long subthreads about it.
Some people even put such guidance in their signatures!
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Alf P. Steinbach wrote: * Victor Bazarov:
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. ... Here it looks more and more like the noise we want to avoid.
Ah, I think you're the one making the noise now. ;-)
Concise guidance on posting is very common and generally works well as long as people don't start long subthreads about it.
This is a good one! :-)
Some people even put such guidance in their signatures!
I've heard of that. Now, if I only could find an example to follow...
Victor Bazarov wrote: 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.howto and give your advice there?
That's ridiculous. First you claim that my comments were inappropriate
to the particular post, now that they aren't welcome period. Well, you
are entitled to your opinion, but I won't pay any attention to it. It's
a dumb one.
Or maybe you could appeal to Google so that they fix their reply mechanism...
Believe me, I've tried, along with many others. They are unresponsive.
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?
No, I do not. Posting in a proper manner is important to effective
communications in this newsgroup. That includes things like proper
quoting. Now, I recognize that many people just don't know that Google
CAN post properly, so I try to help. In some groups, Google is now the
most common source of posts, it is becoming very popular in "emerging"
areas such as India and China. The problem won't go away by ignoring
it.
I also have a personal motive. Due to the problems with our newsfeed, I
have forced to use Google for posting. The flood of new Google users
and the problems from that have some people talking about killfiling
the whole shebang.
Brian 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...
|
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...
|
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...
|
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...
|
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...
|
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
...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |