PC Review


Reply
Thread Tools Rate Thread

Data Repository Class & OOP Inheritance

 
 
Dave Johnson
Guest
Posts: n/a
 
      11th Dec 2005
I have made a Data Repository Class that holds all the Methods for the
Objects that i use in my System such as Order,Client,etc

Example for what i want to do: In the Client Class I want to inherite
from the "DataRepository Class" **ONLY** the methods that is related to
the Client such as GetClientInfo(). and the Same for the Order Class i
want to inherite **ONLY** the methods related to the Order such as
GetOrderIno()

how to do this in OOP? if anyone is able do demostrate and example for
such CASE of Selective Inheritance that would be Very Helpful.

thanks

Sharing makes us all Better

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
 
Reply With Quote
 
 
 
 
Frans Bouma [C# MVP]
Guest
Posts: n/a
 
      11th Dec 2005
Dave Johnson wrote:

> I have made a Data Repository Class that holds all the Methods for the
> Objects that i use in my System such as Order,Client,etc
>
> Example for what i want to do: In the Client Class I want to inherite
> from the "DataRepository Class" ONLY the methods that is related to
> the Client such as GetClientInfo(). and the Same for the Order Class i
> want to inherite ONLY the methods related to the Order such as
> GetOrderIno()
>
> how to do this in OOP? if anyone is able do demostrate and example for
> such CASE of Selective Inheritance that would be Very Helpful.


I think you made a mistake. Instead of adding GetOrderInfo() to the
Datarepository class, you should have made GetInfo() or GetEntityInfo().

Then, you override in every derived class, like Order, Client,
Customer, Product etc., the GetEntityInfo() method. So,
Order.GetEntityInfo() (or Order.GetInfo()) will return the order info,
or whatever data, and in other derived classes it does the same, but
for that particular type. This is polymorphism.

if you then also define an interface, like IEntityAccess, and that
interface has the method GetInfo() or GetEntityInfo(), you can write
generic code which fetches order, customer, product etc, by using that
interface and the method every object implements. You can of course
also cast to the datarepositoryclass and to do the same.

Frans

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inheritance question: How to instantiate derived class from base class Anthony Greene Microsoft C# .NET 15 7th Mar 2007 04:11 PM
How to check base class type of 'open' generic class? (inheritance check) AdawayNoSpam Microsoft VB .NET 2 22nd Aug 2006 08:36 AM
Data Repository Class Vs WebService Dave Johnson Microsoft ADO .NET 2 17th Dec 2005 07:36 PM
Data Repository Class & Inheritance Question Dave Johnson Microsoft Dot NET 3 11th Dec 2005 06:45 PM
facade classes and Howto use the Data Repository Class Dave Johnson Microsoft Dot NET Framework 0 11th Dec 2005 11:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:21 AM.