cloning

Doubts About Core Data NSManagedObject Deep Copy

Hello everyone, I have a situation where I must copy one NSManagedObject from the main context into an editing context. It sounds unnecessary to most people as I have seen in similar situations described in Stackoverflow but I looks like I need it. In my app there are many views in a tab bar and every view handles different information ...

How can a derived C++ class clone itself via a base pointer?

Hi... Here's what I'm trying to do (this code doesn't work): class Base { virtual Base *clone() { return new Base(this); } virtual void ID() { printf("BASE"); }; class Derived : publc Base { virtual Base *clone() { return new Derived(this); } virtual void ID() { printf("DERIVED"); } } . . Derived d; Base *bp = &d; Bas...

How to clone an Object you dont know the type of?

its easier to explain in code so here Object anObj; anObj = new MyObj(); anObj = new Rectangle(); anObj.clone();//this doesnt exist because its on the root Object class what can i use instead of the Object.clone() method in this example? ----------------------- extra info ------------------------------ I have added extra info but it...

Strange problem with reference and object cloning

Hi I have a strange problem with reference and object cloning, which I'm not able to solve. I have a class MyClass which consist of property Name. I also have my custon user control, which have a property of type MyClass - myclassproperty. These controls are placed on form. If I click one of control a new form apperas. I pass one argume...

How to clone an inherited object?

I've got a Tile class with this method: public object Clone() { return MemberwiseClone(); } And another class Checker that inherits from Tile. I also have a Board class that is a List<Tile>. I want to clone the board, so I wrote this: public Board Clone() { var b = new Board(width, height); ...

Cloning vs. Instanciating a new class

Is cloning good practice in this case? How to do it better? public ModelCollection startParsing() { return parseFeed(new ModelSpecialEntry); } public ModelCollection parseFeed(ModelEntry pattern) { ModelCollection modelCollection = new ModelCollection(); while( condition ) { //TODO: Is cloning the best solution? ...

How to get 'git checkout XX' to work from a gitosis based repository?

I have migrated a CVS repository through svn to git, and the resulting repository as generated by svn2git (the one recommended here) has all my old CVS branches available so I can just "git checkout SV46" to get my SV46 branch and then switch to SV48 afterwards. Very nice. I have a gitosis repository set up on a machine named "sandbox"...

exception saving a deep cloned C# nhibernate object

Hi, I'm having a hard time trying to clone a complex C# object persisted with NHibernate. The object has a deeply nested structure with lots of children objects organized in ILists, but it is completely self contained, without references to other persisted entities. What I've tried to do so far is to deep clone the object through seriali...