Hi,
I am a newbie to C# and I have a simple question for you. I have the
following two classes which are used to present information in Excel.
public class Environment : ICloneable, IComparable
{
readonly string name;
readonly int id; // the id of this env
with respect to the env sql table
public int LeftmostCell; // The column number in
Excel
...
}
public class Environments : IEnumerable, ICloneable
{
TestEnvironment[] testEnvironments;
void EstablishExcelLocations()
{
...
}
The function EstablishExcelLocations sets the values of LeftmostCell.
The problem I have is that I have to make LeftmostCell public and it
can now be set from anywhere.
When I derive a class, I often use protected to ensure that only the
derived class can access a certain property. But in this case I'm not
deriving, but it still feels to me that Environments comes from
Environment. Do you understand what I mean? It feels like Environments
should be able to access "protected" members in Environment.
Is there a better way of implementing the above if I don't want to
expose LeftmostCell?
Thanks,
Barry