J
Joe Keller
Hello,
I have a class that allows me to traverse the directory of a data store on
my PPC. The directory structure is setup as follows:
Root
Customer
Processed
System
Processed
I want the developer to be able to easily traverse the directory by using
calls like "Root.Customer.Processed.Value" to get the value/path of the
"Root\Customer\Processed" directory. However, I only want to give the
developer access to the "Root" class - I do not want to let them instantiate
the "Customer", "System", or "Processed" classes directly. How do I limit
the scope of the "Customer", "System", and "Processed" classes such that
they cannot be instantiated directly? I've tried using the various access
modifiers (protected, internal, etc.) to no avail.
The class definition is shown below:
public class Dir
{
public MyRoot Root;
public Dir()
{
this.Root = new MyRoot();
}
public class MyRoot
{
public MyRoot()
{
this.System = new MySystem();
this.Customer = new MyCustomer();
}
public string Value = "\";
public MySystem System;
public MyCustomer Customer;
}
public class MySystem
{
public MySystem()
{
this.Working = new MyWorking();
this.Working.Value = @"\System\Working";
}
public string Value = "\System";
public MyWorking Working;
}
public class MyCustomer
{
public MyCustomer()
{
this.Working = new MyWorking();
this.Working.Value = @"\Customer\Working";
}
public string Value = "\Customer";
public MyWorking Working;
}
public class MyWorking
{
public string Value = "Working";
}
}
Thanks!
Joe
I have a class that allows me to traverse the directory of a data store on
my PPC. The directory structure is setup as follows:
Root
Customer
Processed
System
Processed
I want the developer to be able to easily traverse the directory by using
calls like "Root.Customer.Processed.Value" to get the value/path of the
"Root\Customer\Processed" directory. However, I only want to give the
developer access to the "Root" class - I do not want to let them instantiate
the "Customer", "System", or "Processed" classes directly. How do I limit
the scope of the "Customer", "System", and "Processed" classes such that
they cannot be instantiated directly? I've tried using the various access
modifiers (protected, internal, etc.) to no avail.
The class definition is shown below:
public class Dir
{
public MyRoot Root;
public Dir()
{
this.Root = new MyRoot();
}
public class MyRoot
{
public MyRoot()
{
this.System = new MySystem();
this.Customer = new MyCustomer();
}
public string Value = "\";
public MySystem System;
public MyCustomer Customer;
}
public class MySystem
{
public MySystem()
{
this.Working = new MyWorking();
this.Working.Value = @"\System\Working";
}
public string Value = "\System";
public MyWorking Working;
}
public class MyCustomer
{
public MyCustomer()
{
this.Working = new MyWorking();
this.Working.Value = @"\Customer\Working";
}
public string Value = "\Customer";
public MyWorking Working;
}
public class MyWorking
{
public string Value = "Working";
}
}
Thanks!
Joe