C++ problem (one last try)

Wolfgang Landauer w.landauer at gmx.de
Sun Aug 8 00:59:20 PDT 2004


michael killed the keyboard with:

> #include<iostream>
> using namespace std;
> class car
> {public:
> car();

is the default constructor implemented somewhere?

> char itsName[20];
> car(char a[20]){itsName=a;} //line 7
> };

car(char * a){ //is the same as char a[20] or char a[10] or char a[5]
  strcpy(itsName, a);
}

> int main()
> {car c("citroen");
> 
> cout<<c.itsName;
> return 0;
> }

Wolfgang
-- 
   .-.   This is Linux Country.
   /v\   On a quiet night, you
 /(   )\ can hear Windows reboot.
  ^^ ^^  LFS-No.: 120



More information about the lfs-chat mailing list