Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 16, 2005 typedef-ed class field | ||||
---|---|---|---|---|
| ||||
I cannot access typedef-ed class field. ------------------------------------------------- class Foo{ int i; } typedef Foo Bar; void main(){ Bar bar = new Bar; int n = bar.i; // this for i needs to be type // Foo not type Bar } ------------------------------------------------- -- Mizuno Hiroki |
May 16, 2005 Re: typedef-ed class field | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mizuno Hiroki | Mizuno Hiroki wrote:
> I cannot access typedef-ed class field.
>
> -------------------------------------------------
> class Foo{
> int i;
> }
> typedef Foo Bar;
>
> void main(){
> Bar bar = new Bar;
> int n = bar.i; // this for i needs to be type
> // Foo not type Bar
> }
> -------------------------------------------------
>
> --
> Mizuno Hiroki
Use
alias Foo Bar;
-DavidM
|
May 16, 2005 Re: typedef-ed class field | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Medlock | David Medlock wrote: > Mizuno Hiroki wrote: > >>I cannot access typedef-ed class field. >> >>------------------------------------------------- >>class Foo{ >> int i; >>} >>typedef Foo Bar; >> >>void main(){ >> Bar bar = new Bar; >> int n = bar.i; // this for i needs to be type >> // Foo not type Bar >>} >>------------------------------------------------- >> >>-- >>Mizuno Hiroki > > > Use > > alias Foo Bar; > > -DavidM If I use "alias",I cannot override like this. ------------------------------------------------- class Foo{ ... } typedef Foo Bar1; typedef Foo Bar2; void f(Bar1 bar){...} void f(Bar2 bar){...} ------------------------------------------------- -- Mizuno Hiroki |
May 17, 2005 Re: typedef-ed class field | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mizuno Hiroki | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mizuno Hiroki schrieb am Mon, 16 May 2005 23:50:46 +0900: > I cannot access typedef-ed class field. > > ------------------------------------------------- > class Foo{ > int i; > } > typedef Foo Bar; > > void main(){ > Bar bar = new Bar; > int n = bar.i; // this for i needs to be type > // Foo not type Bar > } > ------------------------------------------------- Added to DStress as http://dstress.kuehne.cn/run/t/typedef_06_A.d http://dstress.kuehne.cn/run/t/typedef_06_B.d http://dstress.kuehne.cn/run/t/typedef_06_C.d http://dstress.kuehne.cn/run/t/typedef_07_A.d http://dstress.kuehne.cn/run/t/typedef_07_B.d http://dstress.kuehne.cn/run/t/typedef_07_C.d http://dstress.kuehne.cn/run/t/typedef_08_A.d http://dstress.kuehne.cn/run/t/typedef_08_B.d http://dstress.kuehne.cn/run/t/typedef_08_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCiipR3w+/yD4P9tIRApyQAJ9eRN/plePRvFYJkeWhd2nPGE4f1wCgzqlK Wqpu8M9NCZovmrXPHLcew2M= =iYXR -----END PGP SIGNATURE----- |
Copyright © 1999-2021 by the D Language Foundation