Data Repository Class & Inheritance Question

D

Dave Johnson

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
 
M

Michael Nemtsev

Hello Dave,

The way to conform your request, u need to create facade classes with methods
only you need.
For example create ClientFacade, with one method that will redirect only
GetClientInfo() calls.
Your client should inherits from facade class.
The same for the Order class


DJ> I have made a Data Repository Class that holds all the Methods for
DJ> the Objects that i use in my System such as Order,Client,etc
DJ>
DJ> Example for what i want to do: In the Client Class I want to
DJ> inherite from the "DataRepository Class" **ONLY** the methods that
DJ> is related to the Client such as GetClientInfo(). and the Same for
DJ> the Order Class i want to inherite **ONLY** the methods related to
DJ> the Order such as GetOrderIno()

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
D

Dave Johnson

Thanks Michael for your fast reply, But i am totally unfamiliar with the
facade classes approach, could u be more helpful if you support your
approach with a Code Snippet, That would be Really Helpful, Thanks in
foreward.

Sharing makes us all Better
 
M

Michael Nemtsev

Hello Dave,

U have "DataRepositoryClass" with several methods and "ClientClass" need
to see and use only DataRepositoryClass::GetClientInfo().

The way to do it - to create additional class "ClientFacade" that will be
derived by ClientClass
ClientFacade class need contains at least one method GetClientInfo that will
call DataRepositoryClass::GetClientInfo().

DJ> Thanks Michael for your fast reply, But i am totally unfamiliar with
DJ> the facade classes approach, could u be more helpful if you support
DJ> your approach with a Code Snippet, That would be Really Helpful,
DJ> Thanks in foreward.

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top