baud@gt-eedsp.UUCP (Kurt Baudendistel) (08/26/88)
if i have defined a class CLASS and create a typedef of it, such as typedef CLASS NEW_CLASS; i would think that i could use NEW_CLASS just like i use CLASS, with constructors, etc. is this true? my gnu c++ compiler thinks that this is the case. it says that CLASS a(5); // legal constructor NEW_CLASS b(5); // illegal constructor is this the same as at&t cfront? is this the way c++ is supposed to work? does this make sense? i think that this should be a legal construct, since this is how i use typedef in c. what do you think? -- Kurt Baudendistel [GRA McClellan] Georgia Tech, School of Electrical Engineering, Atlanta, GA 30332 USENET: ...!{allegra,hplabs,ihnp4,ulysses}!gatech!gt-eedsp!$me INTERNET: $me@gteedsp.gatech.edu
bs@alice.UUCP (Bjarne Stroustrup) (08/26/88)
In article <414@gt-eedsp.UUCP>, baud@gt-eedsp.UUCP (Kurt Baudendistel) writes: > if i have defined a class CLASS and create a typedef of it, such as > > typedef CLASS NEW_CLASS; > > i would think that i could use NEW_CLASS just like i use CLASS, with > constructors, etc. is this true? my gnu c++ compiler thinks that this > is the case. it says that > > CLASS a(5); // legal constructor > NEW_CLASS b(5); // illegal constructor > > is this the same as at&t cfront? is this the way c++ is supposed to > work? does this make sense? > > i think that this should be a legal construct, since this is how i use > typedef in c. what do you think? > > > -- > Kurt Baudendistel [GRA McClellan] > Georgia Tech, School of Electrical Engineering, Atlanta, GA 30332 > USENET: ...!{allegra,hplabs,ihnp4,ulysses}!gatech!gt-eedsp!$me > INTERNET: $me@gteedsp.gatech.edu What you do looks OK to me and this works with cfront (aka the AT&T C++ translator) class x{public: x(int); }; typedef struct x X ; x a(1); X b(1); f() { x(1); X(1); } but why would you want to do this? l i n e e a t e r f o d d e r