Error when using `import`.
Liam McGillivray
yoshi.pit.link.mario at gmail.com
Mon Feb 26 22:40:49 UTC 2024
On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote:
> 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).
Thank you. In PHP, I was told to put every class definition in a
file of the same name (whether I like it or not).
However, I actually now have it working *without* having done
that. Both the file name and the class name are capitalized, and
it's working. However, maybe that's because they each start with
a `module` line that makes the module name lowercase. I will keep
this in mind, and maybe rename the files.
More information about the Digitalmars-d-learn
mailing list