Why is this code returning the wrong type?

Gary Willoughby dev at kalekold.net
Thu May 23 09:27:18 PDT 2013


Why won't the following code compile? Here's the error:

filewatcher.d(21): Error: cannot implicitly convert expression 
(new File(file, "r")) of type File* to shared(_iobuf)*

/**
  * Imports.
  */
import std.stdio;

/**
  * A class to watch for changes in a file.
  */
class Example
{
	/**
	 * Member variables.
	 */
	private FILE* _file;

	/**
	 * Constructor.
	 */
	public this(string file)
	{
		this._file = new File(file, "r");
	}
}


More information about the Digitalmars-d-learn mailing list