Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   compiler warning (http://www.velocityreviews.com/forums/t598157-compiler-warning.html)

djshoham@gmail.com 03-12-2008 04:11 PM

compiler warning
 
Hi the following code gives me the warning "warning: passing
'double' for argument 1 to 'void B::test(int)"

class A
{
public:

void test(int a) {}

void test(double d) {}
};

class B : public A
{
public:

void test(int a)
{
double d = 0.0;
test(d); ---> this line cause the warning.
}
};

But the function "test(double d)" is inherited by B from A. Why can
this function not be resolved.

Thanks.


Puppet_Sock 03-12-2008 04:21 PM

Re: compiler warning
 
On Mar 12, 12:11*pm, djsho...@gmail.com wrote:
[snip]
> But the function "test(double d)" is inherited by B from A. Why can
> this function not be resolved.


Have you read the FAQ?

http://www.parashift.com/c++-faq-lit...heritance.html
Socks

Jeff Schwab 03-12-2008 04:26 PM

Re: compiler warning
 
djshoham@gmail.com wrote:
> Hi the following code gives me the warning "warning: passing
> 'double' for argument 1 to 'void B::test(int)"
>
> class A
> {
> public:
>
> void test(int a) {}
>
> void test(double d) {}
> };
>
> class B : public A
> {
> public:


using A::test;

>
> void test(int a)
> {
> double d = 0.0;
> test(d); ---> this line cause the warning.
> }
> };
>
> But the function "test(double d)" is inherited by B from A. Why can
> this function not be resolved.
>
> Thanks.
>


djshoham@gmail.com 03-13-2008 06:12 AM

Re: compiler warning
 
On Mar 12, 6:21 pm, Puppet_Sock <puppet_s...@hotmail.com> wrote:
> On Mar 12, 12:11 pm, djsho...@gmail.com wrote:
> [snip]
>
> > But the function "test(double d)" is inherited by B from A. Why can
> > this function not be resolved.

>
> Have you read the FAQ?
>
> http://www.parashift.com/c++-faq-lit...heritance.html
> Socks


The FAQ was extremely helpful.

Thanks very much!


All times are GMT. The time now is 10:39 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.