WAP to create a class which stores a dynamic integer array and its size. Include all the constructors and destructor in the class. Store two arrays of different size in two objects. Join the two arrays and and store it in another object using a member function.
#include<iostream>
using namespace std;
class Dynamic{
private:
int size;
int * arr;
public:
Dynamic(){
}
Dynamic(int max){
size = max;
arr = new int[size];
}
~Dynamic(){
cout<<"Destructor called to destroy the objects\n";
}
void join(Dynamic d1(int s2), Dynamic d2(int s2)){
Dynamic d3(s1 + s2);
}
};
Comments
Leave a comment