Skip to content

Instantly share code, notes, and snippets.

@iboB
Created April 8, 2012 11:14
Show Gist options
  • Save iboB/2336670 to your computer and use it in GitHub Desktop.
Save iboB/2336670 to your computer and use it in GitHub Desktop.
My md sandbox

Is this code correct? Please explain.

class Test
{
public:
    int *i; <!--- Bobi: I think the star should be with the int -->
    Test()
    {
        i= new int;
    }
    ~Test()
    {
        delete i;
    }
};

void main()
{
    Test *t= (Test*)malloc (sizeof(Test));
    free (t);
}

(2 points)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment