jeudi 31 mars 2016

Advantage and disadvantage of nested class

When I prefer to store members in struct inside a class and when I prefer to create a nested class in a class and store members?

For example:

class SkypeProtocol
{
public:
    SkypeProtocol();
    virtual ~SkypeProtocol(){}

private:

    class SkypeProtocolDateTime
    {
    private:
        UI32 uDate;
        ERROR GetDateString(PUCHAR pcBuffer,PUI32 uBufLen);
    };

};

or

class SkypeProtocol
{
private:
    SkypeProtocol();
    virtual ~SkypeProtocol(){}

    typedef struct SkypeProtocolDateTime
    {
    private:
        UI32 uDate;
        ERROR GetDateString(PUCHAR pcBuffer,PUI32 uBufLen);
    }SSKYPE_STRUCT;

};

Aucun commentaire:

Enregistrer un commentaire