dynamic constructor in c++ code example
Example: dynamic constructor in c++
//dynamic constructor and application
//code by Soumyadeep Ghosh
//insta : @soumyadepp
//linked in: https://www.linkedin.com/in/soumyadeep-ghosh-90a1951b6/
#include
using namespace std;
class Array
{
int *a;
int size;
public:
Array(int n)
{
a=new int[n]; //dynamic constructor allocating memory for n integers
size=n;
}
void getarr()
{
for(int i=0;i>a[i];
}
}
void putarr()
{
for(int i = 0; i < size ; i++ )
{
cout<