How to implement copy operator for such C++ structure?

Posted by Kabumbus on Stack Overflow See other posts from Stack Overflow or by Kabumbus
Published on 2011-01-31T07:02:48Z Indexed on 2011/01/31 7:25 UTC
Read the original article Hit count: 161

Filed under:
|
|
|
|

So having

struct ResultStructure
{
    ResultStructure(const ResultStructure& other)
    {
        // copy code in here ? using memcpy ? how???  
    }
    ResultStructure& operator=(const ResultStructure& other)
    {
        if (this != &other) {
            // copy code in here ?
        }
        return *this
    }
    int length;
    char* ptr;
};

How to implement copy? (sorry - I am C++ nube)

© Stack Overflow or respective owner

Related posts about c++

Related posts about oop