Links

Categories

Tags


« | Main | »

User defined type aliases

By Jewe | October 29, 2012

// make C++ developers feel more at home
alias int long;
alias float double;

// these two are predefined by the compiler
// alias int char;
// alias int bool;

// we can also use aliases to shorten long names
class System::Network::Socket::Port
{
    int port;
    method Port(int p)
    {
        port = p;
    }
}

alias System::Network::Socket::Port Port;

function main()
{
    Port port = new Port(80);
}

Topics: code examples | Comments Off on User defined type aliases

Comments are closed.