0
I literally copied thus code which perfectly worked. Why the he'll I get so many errors. Could so.eone tell me please?
8 Réponses
+ 1
ohh, now I see. such a fool! thanks a lot KrOW,
0
Simple... Follow error console log, and you will see where (and probably what) are your problems
0
well thanks, but I'm a total begins and I don't get to understand what the error means. if you'd please tell me
0
beginner
0
You have yet corrected the first (missing semicolon).
The other problem is at libe 48 and precisely that you dont call printInfo  method correclty. Try with:
p.printInfo() ;
0
👍👍👍
0
#include <iostream>
using namespace std;
class Id{
    public :
      Id(double i)
      :id(i)
      {}
      void printId(){
          cout<<"your Id is: "<<id<<endl;
      }
      private:
      double id;
};
class Money{
    public :
      Money(int m)
      :money(m)
      {}
      void printMoney(){
          cout<<"Your cash is: "<<money<<endl;
      }
      private :
      int money;
};
class Person{
    public :
     Person (string n, Id ii, Money mm)
    :name(n), identification(ii), cash(mm)
    {}
    void printInfo(){
        cout<<name<<endl;
        identification.printId();
        cash.printMoney();
    }
    private :
    string name;
    Id identification ;
    Money cash;
};
int main(){
    Money cash(12000);
    Id identification(49588892);
    Person p("johnny",identification ,cash);
    p.printInfo();   
}
0
thanksman



