|
-
February 7th, 2010, 10:49 AM
#1
Need help with ineritance tree, new to C#
I am new to C# and am trying to make a .cs file for my ASP.net website to have a few objects to handel file and folder calls. The problem I am running into is with inheritance trees. I have created the base objects and it is inherited by object2, which works fine but when I create object 3 and have it inherit from object two I can not pull the varibles from the base object or object 2. I have attached my current code to the end of this post for your review, can anyone tell me where I am going wrong? I am new to C# and the whole OPP thing. Also if you have any advice on bettering my code I would like to hear them too.
Code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Web;
/// <summary>
/// This file contains the classes for checking for and creating both Files and Folders.
/// </summary>
abstract class BaseHandels
{
private string m_BaseFolderPath = @"D:\FFInfoAdmin\";
private string m_FolderName;
private string m_FileName;
public string BaseFolderPath
{
get { return m_BaseFolderPath; }
}
public string FolderName
{
get { return m_FolderName; }
set { m_FolderName = value; }
}
public string FileName
{
get { return m_FileName; }
set { m_FileName = value; }
}
}
class CheckForFolder:BaseHandels
{
Int32 FolderCheck()
{
if (FolderName == "")
{ return 2; }
else
{
string FolderPath = BaseFolderPath + FolderName;
return (Directory.Exists(FolderPath)) ? 1 : 0;
}
}
}
class CheckForFile:BaseHandels
{
Int32 FileCheck()
{
if (FolderName == "" || FileName == "")
{ return 2; }
else
{
string FilePath = BaseFolderPath + FolderName + @"\" + FileName;
return (File.Exists(FilePath)) ? 1 : 0;
}
}
}
class CreateFolder:CheckForFolder
{
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|