Answer to Question #234717 in C++ for SOM

Question #234717

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.


1
Expert's answer
2021-09-11T23:40:11-0400
#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);
			
		}
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS