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

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to