I cannot seem to pass values to functions by referece.

----------------------------------------------------------------------------------
        @safe public nothrow this(ref Socket socket) {
                // Inside class modulename.classname
                this.socket = socket;
        }
----------------------------------------------------------------------------------
        void main() {
                auto variablename = new modulename.classname(
                        cast(Socket) new TcpSocket() // main.d line 5
                );
        }
----------------------------------------------------------------------------------

This code gives me a compile error:

main.d(5): Error: constructor modulename.classname.this (ref Socket socket) is not callable using argument types (Socket)
main.d(5): Error: no constructor for classname

Why is that?

Reply via email to