On Saturday, 24 February 2024 at 10:31:06 UTC, Liam McGillivray
wrote:
`Unit.d` & `Map.d` are longer files. `Map.d` begins with
`import Tile;`, and `Unit.d` begins with `import Map;`.
Why are the errors happening? What's the problem? Why is it
`currentclass.importedclass` instead of simply the imported
class?
You can't give a class the same name as the file it's in. If you
do, then when you try to use it from another file, the compiler
will get confused and think you're referring to the file instead
of the class (that's what "import is used as a type" means).
The easiest way around this is to change the name of the file to
lower case. So, for example, you could change the name of the
file with the `Unit` class in it to `unit.d`, and then write
`import unit;` to access it from your other files.
- Error when using... Liam McGillivray via Digitalmars-d-learn
- Re: Error w... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- Re: Err... Liam McGillivray via Digitalmars-d-learn
- Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- Re: Error w... Paul Backus via Digitalmars-d-learn
- Re: Err... Liam McGillivray via Digitalmars-d-learn
- Re:... Liam McGillivray via Digitalmars-d-learn
- ... Steven Schveighoffer via Digitalmars-d-learn
- ... Liam McGillivray via Digitalmars-d-learn
- ... Liam McGillivray via Digitalmars-d-learn
- ... Danilo via Digitalmars-d-learn
- ... Liam McGillivray via Digitalmars-d-learn
- ... Danilo via Digitalmars-d-learn
- ... Liam McGillivray via Digitalmars-d-learn
- ... monkyyy via Digitalmars-d-learn