Thread overview | |||||
---|---|---|---|---|---|
|
January 27, 2004 Strange behavior of typedef | ||||
---|---|---|---|---|
| ||||
class MyClass {} typdef MyTypedef {} class MyDerived : MyClass {} class MyTypedefDerived : MyTypedef {} int main () { MyClass foo = new MyDerived(); // works fine MyTypedef bar = new MyTypedefDerived(); // doesn't work :( return 0; } |
January 29, 2004 Re: Strange behavior of typedef | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | "Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bv5i4g$1g73$1@digitaldaemon.com... > class MyClass {} > typdef MyTypedef {} I don't know what you meant to happen here, but "typdef" should be "typedef", and the syntax is for a class declaration, not a typedef. > class MyDerived : MyClass {} > class MyTypedefDerived : MyTypedef {} > > int main () > { > MyClass foo = new MyDerived(); // works fine > MyTypedef bar = new MyTypedefDerived(); // doesn't work :( > > > return 0; > } > > |
January 29, 2004 Re: Strange behavior of typedef | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | >"Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bv5i4g$1g73$1@digitaldaemon.com... >> class MyClass {} >> typdef MyTypedef {} > >I don't know what you meant to happen here, but "typdef" should be "typedef", and the syntax is for a class declaration, not a typedef. Sorry, I ment. class MyClass {} typdef MyClass MyTypedef; Damn. I had this at home, but hadn't have the time to report it. So I did it the next day at work (so I caouldn't use copy&paste). > >> class MyDerived : MyClass {} >> class MyTypedefDerived : MyTypedef {} >> >> int main () >> { >> MyClass foo = new MyDerived(); // works fine >> MyTypedef bar = new MyTypedefDerived(); // doesn't work :( >> >> >> return 0; >> } >> >> > > |
Copyright © 1999-2021 by the D Language Foundation