Tuesday, August 18, 2009

Interview Questions with Design patterns in asp.net

Which of Gang of Four (GOF) design pattern is shown below?
public class A {
private A instance;
private A() {
}
public
static A Instance {
get
{
if ( A == null )
A = new A();
return instance;
}
}
}
1. Factory
2. Abstract Factory
3. Singleton
4. Builder
Answer : Singleton

No comments:

Post a Comment