Summary : How to Use :
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication3
{
abstract class DataAccessLayerBaseClass
{
public abstract void GetConnection();
}
// "ConcreteProductA"
class SQLDataAccessLayer : WindowsApplication3.DataAccessLayerBaseClass
{
public override void GetConnection()
{
MessageBox.Show(this.GetType().ToString());
}
}
// "ConcreteProductB"
class AccessDataAccessLayer : WindowsApplication3.DataAccessLayerBaseClass
{
public override void GetConnection()
{
MessageBox.Show(this.GetType().ToString());
}
}
public class Client
{
public static void Execute()
{
System.Type t = System.Type.GetType("WindowsApplication3.SQLDataAccessLayer");
WindowsApplication3.DataAccessLayerBaseClass obj = Activator.CreateInstance(t) as WindowsApplication3.DataAccessLayerBaseClass;
obj.GetConnection();
t = System.Type.GetType("WindowsApplication3.AccessDataAccessLayer");
obj = Activator.CreateInstance(t) as WindowsApplication3.DataAccessLayerBaseClass;
obj.GetConnection();
}
}
}
Thanks & Regards,
Arun Manglick
SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258
DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
No comments:
Post a Comment