|
-
April 15th, 2014, 04:39 AM
#1
simple issue on function overloading in c++
I'm really confused and hence putting this very simple on function overloading. Below is the sample code
struct X
{
};
struct Y
{
}
struct Z
{
};
X x1;
Y y1;
Z z1;
set_data(X *m)
{
// need to initialize Z and Y from this funciton by getting reference to an instance
// create instance of X,Y,Z
set_data(&y1);
set_data(&z1);
}
set_data(Y *m)
{
// to initialize Y struct
}
set_data(Z *m)
{
// to initialize Z struct
}
But i do so it gives error "error C2664: 'set_data' : cannot convert parameter 1 from 'X *' to 'Y *'
Please suggest me where i'm wrong in above code
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|