Home » U++ Library support » U++ Core » Derivating from Vector<>
Derivating from Vector<> [message #8343] |
Sat, 03 March 2007 20:12  |
victorb
Messages: 78 Registered: December 2005 Location: Nice, France
|
Member |
|
|
I am trying to derivate a class from Vector<...> but I can't get it to work. Any help from the Upp community would be welcome.
Here is some sample code:
#include <Core/Core.h>
using namespace Upp;
class IntVector : public DeepCopyOption<IntVector, Vector<int> >
{
public:
IntVector(){Cout() << "IntVector\n"; }
virtual ~IntVector(){Cout() << "~IntVector\n";}
IntVector(const IntVector &src, int) {
::new IntVector;
Vector<int>(src, 0);
name = src.name;
Cout() << "DCC\n";
}
String name;
String ToString(void) {
String dump;
dump << name << " ";
if (IsPicked()) return dump << "Picked";
for (int i = 0; i < GetCount(); i++) {
dump << At(i) << " ";
}
return dump;
}
};
CONSOLE_APP_MAIN
{
Cout() << "iv\n";
IntVector iv;
iv.name = "IV";
iv.Add(5);
iv.Add(6);
Cout() << "iv2\n";
IntVector iv2(iv, 0);
Cout() << iv.ToString() << "\n";
Cout() << iv2.ToString() << "\n";
}
I expect iv2 to be equal to iv at the end. There is probably something wrong with the deep copy constructor but I really can't figure it out.
Victor
[Updated on: Wed, 07 March 2007 00:55] Report message to a moderator
|
|
|
 |
|
Derivating from Vector<>
By: victorb on Sat, 03 March 2007 20:12
|
 |
|
Re: Deriving from Vector<>
By: victorb on Sat, 03 March 2007 20:37
|
 |
|
Re: Deriving from Vector<>
By: victorb on Sat, 03 March 2007 20:48
|
 |
|
Re: Deriving from Vector<>
By: victorb on Sat, 03 March 2007 22:17
|
 |
|
Re: Deriving from Vector<>
By: victorb on Wed, 07 March 2007 00:54
|
 |
|
Re: Deriving from Vector<>
By: victorb on Wed, 07 March 2007 01:14
|
 |
|
Re: Derivating from Vector<>
By: victorb on Wed, 07 March 2007 01:30
|
 |
|
Re: Derivating from Vector<>
By: victorb on Wed, 07 March 2007 17:05
|
 |
|
Re: Derivating from Vector<>
By: mirek on Thu, 08 March 2007 13:55
|
 |
|
Re: Derivating from Vector<>
By: victorb on Thu, 08 March 2007 16:30
|
Goto Forum:
Current Time: Sun Jun 15 02:24:23 CEST 2025
Total time taken to generate the page: 0.05863 seconds
|