compiler warning

Discussion in 'C++' started by djshoham@gmail.com, Mar 12, 2008.

  1. Guest

    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.
     
    , Mar 12, 2008
    #1
    1. Advertising

  2. Puppet_Sock Guest

    Puppet_Sock, Mar 12, 2008
    #2
    1. Advertising

  3. Jeff Schwab Guest

    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.
    >
     
    Jeff Schwab, Mar 12, 2008
    #3
  4. Guest

    On Mar 12, 6:21 pm, Puppet_Sock <> wrote:
    > On Mar 12, 12:11 pm, 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-lite/strange-inheritance.html
    > Socks


    The FAQ was extremely helpful.

    Thanks very much!
     
    , Mar 13, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sravan reddy

    warning when using design compiler

    sravan reddy, Aug 14, 2005, in forum: VHDL
    Replies:
    0
    Views:
    505
    sravan reddy
    Aug 14, 2005
  2. Pete Becker
    Replies:
    0
    Views:
    1,407
    Pete Becker
    Feb 10, 2005
  3. B. Williams

    warning C4267 and warning C4996

    B. Williams, Oct 26, 2006, in forum: C++
    Replies:
    17
    Views:
    2,678
  4. WARNING! Prosoftstore.com is a SCAM! WARNING!

    , Jul 8, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    348
  5. Julian Mehnle
    Replies:
    17
    Views:
    960
    Julian Mehnle
    May 18, 2006
Loading...

Share This Page