Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!ucsd!rutgers!bellcore!faline!thumper!ulysses!andante!alice!bs From: bs@alice.UUCP (Bjarne Stroustrup) Newsgroups: comp.lang.c++ Subject: Re: typedef's of classes Summary: legal Keywords: c++, typedef, class Message-ID: <8134@alice.UUCP> Date: 26 Aug 88 01:15:04 GMT References: <414@gt-eedsp.UUCP> Distribution: na Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 55 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