-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (21 loc) · 702 Bytes
/
Program.cs
File metadata and controls
27 lines (21 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
namespace Patterns.Prototype
{
class Program
{
static void Main(string[] args)
{
var original = new Person();
original.FirstName = "Sam";
original.LastName = "jones";
original.Address = new Address("London");
Console.WriteLine("original - " + original);
var clone = original.Clone() as Person;
Console.WriteLine("clone without changes - " + clone);
clone.FirstName = "Bill";
clone.LastName = "Gates";
clone.Address = new Address("Somewhere in the US");
Console.WriteLine("clone with changes - " + clone);
}
}
}