473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

C# Hide Base Class

I'm creating a library with some functions that I occasionally use ;) and was wondering if anyone can help me with a minor problem.

I have some file operations that I cba to write code for every time so I made 2 classes (one for Files and one for Directories). Then I realized they share 2-3 functions. Here's part of the code:
Expand|Select|Wrap|Line Numbers
  1. namespace Something.IO
  2. {
  3.     public abstract class Shared
  4.     {
  5.         public static String GetShortName(String Fullname)
  6.         {
  7.             ...
  8.         }
  9.     }
  10.  
  11.     public class File : Shared
  12.     {
  13.         ...
  14.     }
  15.  
  16.     public class Directory : Shared
  17.     {
  18.         ...
  19.     }
  20. }
Is it possible to hide the class Shared somehow? I know I'm not supposed etc but if I really want to is it possible? Without having to write the code twice in each class?
Aug 23 '08 #1
1 1356
NitinSawant
270 100+
youcan use sealed keword to configure the class inaccessible for inheriting
Aug 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: C-Sharper or C-Hasher, one of the two | last post by:
Hi, I have a C# class libary (Class1) which is inherited by another class in a Windows Forms app. I want this other class to implement some, but not all of the features of the base class. How...
2
by: owingruters | last post by:
Hi all, I'm trying to hide a member from a base class, like so : public class class1 { public class1() { } public int i; }
6
by: Alex Sedow | last post by:
Example 1 interface I { string ToString(); } public class C : I { public void f() {
3
by: mfc_mobile | last post by:
Hi, I'm trying to develop a control and want to hide the base class of the control, how do i do that? I want to do something like the follow :- internal class BaseClass { }
4
by: Paul Wu | last post by:
Is there a way to constract a derived class that hides certain public members of a base class ? With the following code, a class that derives from DerivedClass can still see the member "Name" in the...
9
by: Martin Widmer | last post by:
Hello! I would like to hide one property of a base class in a derived class. How could it be done? I tried to override it with a private property, but that doesn't seem to do the hiding. ...
6
by: Guch Wu | last post by:
There is a baseclass A. B is its subclass. I want to hide class B. All operations to B are all by means of virtual functions in A. Class users can only see class A. B is transparent to them. ...
4
by: David Veeneman | last post by:
Is it possible to hide a component that is used as a base class for other components? I have two components that perform the same job. Their only difference is that one works with objects, and...
6
by: --== Alain ==-- | last post by:
Hi, I derived a control to create my custom control. However, some of the control base properties are useless from my point of view and i would like to avoid control user to change them. How...
2
by: dolphin | last post by:
Hi everyone . I am confused about the different between override overload and hide. May be I have a wrong opinion, I always think that hide is very similar with override. Both of them call the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.