Hi Islam,
Use the Factory Method pattern
There's a good tutorial here:
http://www.devhood.com/tutorials/tut...utorial_id=645
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Islam Elkhayat" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have to 2 Data classes have the same methods with defferent implemention
> which work with 2 tables in the database..
> I want to chnge the instance referance depend on if condition or switch
> case..
> like this...
>
> myclass.AddRow()
>
> where my class can be instance of Categories or Employees so i don't have
> to
> write the same code twice..
> I tried Activator.CreateInstance(); which return an object but i couldn't
> access methods..
> Is there a way to make it work??
> thanx
>
>
>