creativity is that spark of electricity before an explosion.
it allows us, in a single instance to explore all possibilities without hesitation.
|
|
Provide a surrogate or placeholder for another object to control access to it.
The classes and/or objects participating in this example are:
|
|
// Proxy pattern -- Structural example
|
|
using
System;namespace { // MainApp test application class MainApp { static void Main() { // Create proxy and request a service Proxy proxy = new Proxy(); proxy.Request(); // Wait for user Console.Read(); } } // "Subject" abstract class Subject { public abstract void Request(); } // "RealSubject" class RealSubject : Subject { public override void Request() { Console.WriteLine("Called RealSubject.Request()"); } } // "Proxy" class Proxy : Subject { RealSubject realSubject; public override void Request() { // Use 'lazy initialization' if (realSubject == null) { realSubject = new RealSubject(); } realSubject.Request(); } } } |
| [+] | Programming - Prototype Design Pattern |
| [+] | Programming - Iterator Behavioral Design Pattern |
| [+] | Programming - Mediator Behavioral Design Pattern |
| [+] | Programming - Prototype Design Pattern |
| [+] | Programming - Iterator Behavioral Design Pattern |
| [+] | Programming - Mediator Behavioral Design Pattern |
| [+] | Programming - Prototype Design Pattern |
| [+] | Programming - Iterator Behavioral Design Pattern |
| [+] | Programming - Mediator Behavioral Design Pattern |
| [+] | Programming - Prototype Design Pattern |
| [+] | Programming - Iterator Behavioral Design Pattern |
| [+] | Programming - Mediator Behavioral Design Pattern |
| [+] | Request Quote |
| [+] | Programming - Prototype Design Pattern |
| [+] | Programming - Iterator Behavioral Design Pattern |
