Solved

C# newbie question

Posted on 2009-05-19
5
175 Views
Last Modified: 2012-05-07
Hi.  My question is that if I have an Data Access Layer that writes to a DB, then a Rules layer that inherits the DAL, then a presentation layer that inherits the Rules Layer, how can I keep the methods in the DAL hidden from the presentation layer??
0
Comment
Question by:suicehockey44
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:saragani
ID: 24422714
0
 

Author Comment

by:suicehockey44
ID: 24422752
I see. But doesn't the Sealed class eliminated the possibility of any inheritance??? I want the Rules layer to inherit the DAL.  BUT, I do not want the other class, which inherits the Rules Layer to have access to the methods in the DAL...perhaps I am not following sealed closely enough.
0
 
LVL 11

Accepted Solution

by:
saragani earned 500 total points
ID: 24422769
Oops sorry. I didn't read your question right... You want to prevent the inheritance of functions (not classes).. My bad.

It cannot be done... Any public method is being inherited by the child class.


The only way I can thing of is that the child class will implement an interface and then then you work with the presenter, you will always work with it using an interface object.
0
 

Author Comment

by:suicehockey44
ID: 24422801
Ok sorry I should've been more clear. Thank you and I will try using an interface.
0
 
LVL 11

Expert Comment

by:saragani
ID: 24422838
I've looked for a short example on the Internet for you:
http://stackoverflow.com/questions/106383/c-can-publicly-inherited-methods-be-hidden-e-g-made-private-to-derived-class


And you've been clear enough...  it's just me ending 11 hours of work in front of the computer and visual studio.
(Lucky me, this day is over :-) )
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now