Importing struct

Andrey saasecondbox at yandex.ru
Mon Aug 13 12:34:25 UTC 2018


Hello,

This is my test project:
source/app.d
source/MyClass.d

app.d:
------------------------------------------------
import std.stdio;
import MyClass;

void main(string[] args)
{
     MyClass.MyClass.parse(args); // I want just 
MyClass.parse(args);
}
------------------------------------------------

MyClass.d
------------------------------------------------
import std.stdio;

struct MyClass
{
     static void parse(string[] args)
     {

     }
}
------------------------------------------------

In "main" function I need to write "MyClass.MyClass.parse(args)" 
bit I want just "MyClass.parse(args)". If I do so then I have an 
error:
Error: undefined identifier parse in module MyClass.

Of course function "parse" doesn't exist in this module. But it 
exists inside struct "MyClass"!
What should I do to import my struct correctly?


More information about the Digitalmars-d-learn mailing list