Solved

C# newbie question

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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