G
Guest
I am having some trouble understanding scope when creating my component.
Basically I have a primary class entitled permissionRights. This class
creates several public properties of instances of other classes. Each of the
other classes are not child classes of permisions rights. Which is to say
public class PermissionRights
private pvPartition as new Partition
private pvDatabaseConnection as string
public readonly property Partition() as Partition
.... return pvPartition
end property
public readonly property DatabaseConnection() as string
...return pvDatabaseConnection
end property
end class
public class Partition
sub new()
dim test as new string=pvDatabaseConnection
end sub
end class
In the above code the class partition needs to access the value stored in
databaseconnection string. Put it is not aware of it. Now I know I can pass
it on the sub new byref but do I need to. Both classes are in the same
project/assembly. I should be able to access the
PermissionRights.DatabaseConnection public property as a min for the current
instance.
So do I make the Partition class a sub class of permission rights. When I
do that the code analyzer says I should make it private yet it does need to
be public?
Please help, just lost in scope at the moment
Cheers
Keith
Basically I have a primary class entitled permissionRights. This class
creates several public properties of instances of other classes. Each of the
other classes are not child classes of permisions rights. Which is to say
public class PermissionRights
private pvPartition as new Partition
private pvDatabaseConnection as string
public readonly property Partition() as Partition
.... return pvPartition
end property
public readonly property DatabaseConnection() as string
...return pvDatabaseConnection
end property
end class
public class Partition
sub new()
dim test as new string=pvDatabaseConnection
end sub
end class
In the above code the class partition needs to access the value stored in
databaseconnection string. Put it is not aware of it. Now I know I can pass
it on the sub new byref but do I need to. Both classes are in the same
project/assembly. I should be able to access the
PermissionRights.DatabaseConnection public property as a min for the current
instance.
So do I make the Partition class a sub class of permission rights. When I
do that the code analyzer says I should make it private yet it does need to
be public?
Please help, just lost in scope at the moment
Cheers
Keith