Why is this code returning the wrong type?

dennis luehring dl.soluz at gmx.net
Thu May 23 13:00:18 PDT 2013


Am 23.05.2013 21:45, schrieb Gary Willoughby:
> Hmmm... Following your example i'm still having problems
> compiling this simple snippet:
>
> import std.stdio;
>
> class Example
> {
> 	private FILE _file;
>
> 	public this(string file)
> 	{
> 		this._file = File(file, "r");
> 	}
> }
>
> Error:
>
> test.d(9): Error: cannot implicitly convert expression ((File
> __ctmp1220 = 0;
>    , __ctmp1220).this(file, "r")) of type File to shared(_iobuf)
>

you former

private FILE* _file wasn't an File

and your current

private FILE _file is still not File

because FILE and File is something differnt (case sensitive)

why not write

private File _file


More information about the Digitalmars-d-learn mailing list