What
is the need for Bridge Pattern in C#?
You can use
Builder pattern if you want to separate abstraction and implementation
of your program so that they can be maintained independently.
Amazon.in Today's Special Deals Great Savings... Everyday! Tuesday, January 26th, 2021
CHECK NOW >>
Here is a code sample for it:
class sampleAbstraction
{
protected sampleImplementation impObj;
public sampleImplementation ImpObj {
set { impObj = value;}
}
public virtual void sampleMethod() {
impObj.sampleMethod();
}
}
class sampleImplementation {
public virtual void sampleMethod() {
Console.WriteLine(Executing sampleMethod of sampleImplementation);
}
}
class derivedAbstraction : sampleAbstraction {
public override void sampleMethod() {
impObj.sampleMethod();
}
}
public class testClass {
public static void Main() {
abstractionPart absObj = new derivedAbstraction();
absObj.ImpObj = new sampleImplementation();
absObj.sampleMethod();
}
}

FREE
Subscription
Subscribe
to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.
Note
: We never rent, trade, or sell my email lists to
anyone.
We assure that your privacy is respected
and protected.
Visit
.NET Programming Tutorial Homepage
______________________________________________________
Recommended
Resource
|