By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,420 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,420 IT Pros & Developers. It's quick & easy.

pointer

P: 1
Can anybody tell me whgat is wrong with this code.
Expand|Select|Wrap|Line Numbers
  1.  
  2. class base
  3. {
  4.  
  5.  
  6.     int i;
  7.     char c;
  8.     float f;
  9.  
  10.  
  11.  
  12. public:
  13.  
  14.     void display(int,char,float);
  15.     base *myfun();
  16.  
  17.  
  18. };
  19.  
  20. void base::display(int j,char a,float g)
  21. {
  22.  
  23.     i=j;
  24.     c=a;
  25.     f=g;
  26.     cout<<i;
  27.     cout<<c;
  28.     cout<<f;
  29.  
  30. }
  31.  
  32. base b1;
  33. int main()
  34. {
  35.  
  36.  
  37.  
  38.  
  39.  
  40.     base* b2=b1.myfun();
  41.     b2->display(30,'d',3.5);
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. _getch();
  50. return 0;
  51.  
  52. }
Feb 26 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,510
you have not defined (written the code) for base::myfun() so you get a linker error indicating it is missing
Feb 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.