Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Adding subclass objects to base class array using AppendPick()
icon5.gif  Adding subclass objects to base class array using AppendPick() [message #9315] Thu, 26 April 2007 17:01 Go to next message
captainc is currently offline  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

Re: Adding subclass objects to base class array using AppendPick() [message #9561 is a reply to message #9315] Thu, 17 May 2007 14:36 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Sorry, for misshing this post....

And sorry once again, it is hard to decipher your intentions here.

Would you mind posting the code snippet to explain?
Previous Topic: IsUpper bug?
Next Topic: i18n
Goto Forum:
  


Current Time: Sun Apr 28 20:58:24 CEST 2024

Total time taken to generate the page: 0.07013 seconds