I've got a class ("ParentClass") which has several private attributes, one of those being an array of type "ChildClass". All I need is a method which can return the array contained within the "ParentClass". How do I return an array from a method? Note the following example scenario.
The header file's private attributes definition, defining the array attribute (with a fixed size), among other attributes:
Code:
private:
ChildClass super_array[5];
int whatever_number;
...
...
My attempt at defining a GetSuperArray() Method, (which does not work):
Code:
ChildClass ParentClass::GetSuperArray() {
return *super_array;
}
I don't know what I am suppose to be returning...a pointer to the first element in an array, some sort of reference, or what. I don't want a single element returned--I want the entire array.
Again, this is an array of type "ChildClass" which is stored as an attribute of "ParentClass". All I need is a GetSuperArray() method to be appropriately defined in the parent_class.cc file, that which contains all "ParentClass" methods.