Saturday, 28 September 2013

copy object pointer into dynamic object array

copy object pointer into dynamic object array

I am working with a class I created that has a function addClass which
allow the user to add A an Instance of Class to a dynamically allocated
array.
Here is the code of the class and a simple test:
Class.h Listing
#ifndef CLASS_H
#define CLASS_H
#include<iostream>
class Class {
public:
Class(std::string text);
Class(const Class& orig);
virtual ~Class();
Class(std::string text, Class * name, int size); //"The Other
constructor"
std::string toString();
void addClass(Class * name, int size = 1);
Class getClass(int index);
private:
Class * classArray;
std::string value;
int size;
};

No comments:

Post a Comment