Solved

C# newbie question

Posted on 2009-05-19
5
174 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

11 Experts available now in Live!

Get 1:1 Help Now