views:

47

answers:

3

Which and all design patterns & Classes can be used for Copy-Paste Operation ?

A: 

Sorry, but I think you're coming at Design Patterns from the wrong direction.

Start by doing your OO design, identify classes etc. "Copy and Paste" is far too generic a term for us to guess what classes you might need. Having got an initial design in place then one starts to identify relationships between classes and degrees of coupling between them. At that point you say things like "Hmm, this class shouldn't know about how to create that class, hmm maybe I need a Factory." and "I don't want this class to have tell all those classes that something interesting has happened, maybe I need an Observer pattern".

djna
A: 

You need to think about your solution first before applying principles of design patterns to it.

Copy and paste can crudely be implemented using a stack, one copy operation would 'push' your desired object at its current state onto the stack, and a paste operation would pop it off.

djhworld
A: 

Each Design pattern solves a specific problem and you have not mentioned enough details about your problem here, without adequate information we cannot reach to a conclusion which design pattern should you use, or should you apply any pattern at all. Remember - patterns cannot be applied everywhere.

this. __curious_geek