Sunday, February 17, 2013

[c/c++] initialization and instantiation... prototyped function not called (was a variable definition intended?)




// Correct initialization with default Constructor of A
ClassA a;

// Incorrect initialization
ClassA a();

// Correct initialization, returning a pointer to an object (http://www.cplusplus.com/reference/new/operator%20new/)


  MyClass * p1 = new MyClass;
      // allocates memory by calling: operator new (sizeof(MyClass))
      // and then constructs an object at the newly allocated space

1 comment:

  1. Vint Ceramic Art | TITNIA & TECHNOLOGY
    Explore an all https://febcasino.com/review/merit-casino/ new titanium flat iron “Vint Ceramic Art” project on TITNIA & TECHNOLOGY. Our team of sculptors and artists have created new apr casino and

    ReplyDelete