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++ Widgets - General questions or Mixed problems » why no 'Ctrl* Ctrl::Clone() const = 0' (virtual constructor)
Re: why no 'Ctrl* Ctrl::Clone() const = 0' (virtual constructor) [message #28381 is a reply to message #28377] Tue, 31 August 2010 13:45 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
the new Ctrl would go to an Array<Ctrl>::Add(Ctrl* newt);
so it wont disappear..

this clone feature is quite well known from C# and i learned to like it..it enables you to manage your object containers from 'bottom', kind of flexibility.

something like the following woule be a layer to use maybe, but includes changes as well

template<class T>
class Clonable
{
public:
	virtual T* Clone() const { return DeepCopyNew<T>(*(T*)this); }
	virtual T* PartialClone() const { return new T(); }
};

class ValueC
	: public Value, public Clonable<ValueC>
{
public:
	ValueC() {}
	ValueC(const Value& v) : Value(v) {}
};

template<class T>
T* Clone(const T& c) { return DeepCopyNew(c); }

template<class T>
T* PartialClone(const T&) { return new T(); }

[Updated on: Tue, 31 August 2010 13:47]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dockable toolbars
Next Topic: ColumnList RefreshCursor public
Goto Forum:
  


Current Time: Mon May 13 01:14:46 CEST 2024

Total time taken to generate the page: 0.02129 seconds