help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it not possible to use unsigned short and bool data types simultaneou


From: Deepak Goyal
Subject: Is it not possible to use unsigned short and bool data types simultaneously for function overload?
Date: Thu, 13 Dec 2007 11:04:04 +0530

Hi,

       In this program I am getting some error. When I use unsigned short int and bool for function overload. I am using GCC 3.4.4 compiler. During compile time I get this error. Is it not possible to use unsigned short and bool data types simultaneously? Is it a bug in GCC?

 

"E:\\Workspace\\Function overload\\bool.cpp", line 29: error: more than one

          instance of overloaded function "display::my_method" matches the

          argument list:

            function "display::my_method(unsigned short)"

            function "display::my_method(bool)"

            argument types are: (int)

            object type is: display

    s.my_method(4);

      ^

 

I am really stuck in it please help me.

 

 

 

 

#include<iostream.h>

class display

{

   public :

  int my_method(unsigned short int);

   int my_method(bool);

  

 

} s;

int display :: my_method(unsigned short int d)

{

   cout<<"Value of d is "<<d;

}

int display :: my_method(bool f)

 

{

 cout<<"Value of f is"<<f;

}

int main()

 

{

  s.my_method(4);

  s.my_method(true);

 

}

 

Deepak Goyal


reply via email to

[Prev in Thread] Current Thread [Next in Thread]