Explain dynamic constructor with example.
#include <iostream>
using namespace std;
class Dynamic{
public:
Dynamic(){};
void display(){
cout<<"Object constructed successfully";
}
};
int main(){
Dynamic *object = new Dynamic(); //Dynamic constructor
object->display();
return 0;
}
Comments
Leave a comment