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

how to fix [Error] expected unqualified-id at end of input

P: 1
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. using namespace std;
  3. class DB;
  4. class DM{
  5.     public:
  6.         DM(){}
  7.         DM (float meter, float cm);
  8.         friend int func(DM,DB);
  9. };
  10.  
  11. class DB
  12. {
  13. float ft;
  14. float inches;
  15.  
  16. public:
  17. DB(){}
  18. DB(float fe,float inc){
  19. ft=fe;
  20. inches=inc;
  21. };
  22.  
  23. void display(){
  24.  
  25.     cout<<"\n Feet is :"<<ft;
  26.     cout<<"\nInches are:"<<inches;
  27. };
  28. int main (){
  29.     DM a;
  30.     DB b;
  31.     cout<<"Data : "<<func(a, b);
  32.     return 0;
  33. }
May 5 '14 #1
Share this Question
Share on Google+
2 Replies


P: 94
Hello! I have some questions/observations:

1. Why did you write class DB in both lines 3 and 11?
2. In line 25, you try to directly access private variable ft. It can't be done, even if you have an object of its class - DB (which you don't). The same happens in line 26 with variable inches.
3. In which line(s) is the error, according to the compiler/linker?
May 5 '14 #2

P: 6
You need one more '};' after finishing main(), for class DB
May 6 '14 #3

Post your reply

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