d类名不要与模块名相同

原文

module Console;
//模块名,

import std.string;
import core.sys.windows.windows;

class Console {
    public:
        HANDLE hIn;
        HANDLE hOut;

    this(HANDLE hIn, HANDLE hOut) {
        this.hIn = hIn;
        this.hOut = hOut;
    }
}
//这里名字不要取Console.d

服务器:

module Server;

import std.string;
import core.sys.windows.windows;
//import Console;
import console;
//原改成下面的小写.

class Server : Console {
    this(HANDLE hIn, HANDLE hOut) {
        super(hIn, hOut);
    }

    ~this() {
        // Delete object;
    }
}
void main()
{
    Server s;
}

模块名,不要与类名冲突.这里主要是文件名不要冲突.窗口下,Console直接重命名为console,还不行,先要不一样,再改成小写,如中间名为cons.

posted @ 2022-09-11 08:29  zjh6  阅读(16)  评论(0)    收藏  举报  来源