Home » U++ Library support » U++ Core » Adding subclass objects to base class array using AppendPick()
Adding subclass objects to base class array using AppendPick() [message #9315] |
Thu, 26 April 2007 17:01 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
I have 1 base class and 3 subclasses. I want to build an array with all of the classes in it and then sort the array on a given variable. I have the operator< defined so I can call sort on the final array, but I am getting an error when trying to call AppendPick() to add all the objects of a subclass to the base class array. Basically, I created an array of the base class, filled it with one subclass type (subclass A) and then tried to append an array of another subclass (subclass B) to it.
My error says:
'void Upp:Array<T>::Append(const Upp:Array<T> &)' : cannot convert parameter 1 from 'ClassAList' to 'const Upp::Array<T> &'
Also, ClassAList is a typedef of Array<ClassA>
--> "typedef Array<ClassA> ClassAList;"
How can I make this work correctly?
Any help is much appreciated.
[Updated on: Thu, 26 April 2007 17:03] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sun Apr 28 20:58:24 CEST 2024
Total time taken to generate the page: 0.07013 seconds
|