inst = NS_STATIC_CAST(nsIUrl*, url);
inst = NS_STATIC_CAST(nsITypicalUrl*, url);
nsNetFactory::CreateInstance(nsISupports *aOuter,                             const nsIID &aIID,                             void **aResult){    nsresult rv;    if (aResult == nsnull)        return NS_ERROR_NULL_POINTER;    nsISupports *inst = nsnull;    if (mClassID.Equals(kNetServiceCID)) {        if (aOuter) return NS_ERROR_NO_AGGREGATION;        nsNetService* net = new nsNetService();        if (net == nsnull)            return NS_ERROR_OUT_OF_MEMORY;        rv = net->Init();        if (NS_FAILED(rv)) {            delete net;            return rv;        }        inst = net;    }    else if (mClassID.Equals(kFileTransportServiceCID)) {        if (aOuter) return NS_ERROR_NO_AGGREGATION;        nsFileTransportService* trans = new nsFileTransportService();        if (trans == nsnull)            return NS_ERROR_OUT_OF_MEMORY;        rv = trans->Init();        if (NS_FAILED(rv)) {            delete trans;            return rv;        }        inst = trans;    }    else if (mClassID.Equals(kSocketTransportServiceCID)) {        nsSocketTransportService* trans = new nsSocketTransportService();        if (trans == nsnull)            return NS_ERROR_OUT_OF_MEMORY;        rv = trans->Init();        if (NS_FAILED(rv)) {            delete trans;            return rv;        }        inst = NS_STATIC_CAST(nsISocketTransportService*, trans);     }    else if (mClassID.Equals(kTypicalUrlCID)) {        nsUrl* url = new nsUrl(aOuter);        if (url == nsnull)            return NS_ERROR_OUT_OF_MEMORY;        inst = NS_STATIC_CAST(nsIUrl*, url);    }    else {        return NS_ERROR_NO_INTERFACE;    }    NS_ADDREF(inst);    *aResult = inst;    return rv;}