C# Hide Base Class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DonBytes
    New Member
    • Aug 2008
    • 25

    #1

    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:
    Code:
    namespace Something.IO
    {
    	public abstract class Shared
    	{
    		public static String GetShortName(String Fullname)
    		{
    			...
    		}
    	}
    
    	public class File : Shared
    	{
    		...
    	}
    	
    	public class Directory : Shared
    	{
    		...
    	}
    }
    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?
  • NitinSawant
    Contributor
    • Oct 2007
    • 271

    #2
    youcan use sealed keword to configure the class inaccessible for inheriting

    Comment

    Working...