オブジェクトを動的に割り当て

#include 
using namespace std;

class samp {
    int i, j;
public:
    void set_ij(int a, int b){ i=a; j=b; }
    int get_product() { return i*j; }
};

int main()
{
    samp *p;
    
    p = new samp;
    if(!p){
        cout << "memory set error\n";
        return 1;
    }
    
    p->set_ij(4, 5);
    cout << "multiply is :" << p->get_product() << "\n";
    delete p;
    return 0;
}