Accessing class with module name as Java's
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 12 10:11:34 PST 2015
tcak:
> One way I achieved it, though I cannot put namespace on it.
>
>
> file: project.d
> ==================
> module project;
>
> class project{}
D modules can contain lot of stuff, like variables, constants,
enums, types, structs, etc. And you usually put more than one
class in each D module. Also D class names should be capitalized
(like "Project").
> When I do this, it works, but I cannot make it work with
> namespace unfortunately.
What namespace? D has modules, unlike C++. In general it's a bad
idea to have inside a module a name (like a variable name or
struct name) equal to the module name, because it causes
confusion.
Please show what doesn't work.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list