Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C# newbie question

Posted on 2009-05-19
5
Medium Priority
?
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

597 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