www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - import `Class` is used as a type

reply Injeckt <vinsentlou9 gmail.com> writes:
I'm trying use classes in my project, but when i'm try inherit 
class, I get error:

         Error: import `Server.Console` is used as a type


Server.d:

         module Server;

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

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

             ~this() {
                 // Delete object;
             }
         }


Console.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;
             }
         }

What does it mean?
Sep 10 2022
parent reply "H. S. Teoh" <hsteoh qfbox.info> writes:
On Sat, Sep 10, 2022 at 04:59:50PM +0000, Injeckt via Digitalmars-d-learn wrote:
 I'm trying use classes in my project, but when i'm try inherit class,
 I get error:
 
         Error: import `Server.Console` is used as a type
[...] Don't name the module the same thing as the class. Rename it to, say, `console`, so that it wouldn't clash with the class name `Console`. T -- IBM = I Blame Microsoft
Sep 10 2022
parent Injeckt <vinsentlou9 gmail.com> writes:
On Saturday, 10 September 2022 at 17:20:29 UTC, H. S. Teoh wrote:
 On Sat, Sep 10, 2022 at 04:59:50PM +0000, Injeckt via 
 Digitalmars-d-learn wrote:
 I'm trying use classes in my project, but when i'm try inherit 
 class, I get error:
 
         Error: import `Server.Console` is used as a type
[...] Don't name the module the same thing as the class. Rename it to, say, `console`, so that it wouldn't clash with the class name `Console`. T
Thank you!
Sep 10 2022