>Hallo Mathias,
>würde ich schon denken.
Schade eigentlich ;-)
>
>If you read the help for Properties and methods
>
Protected properties cannot be accessed by object instances, but can be accessed by subclasses. Hidden properties cannot be accessed by either object instances or subclasses.>it follows that a pretected object accessible only within it's parent. If you would like to have information about the object (or run a method) you need to ask objects parent to do the job (the code for that is up to you, naturally).
>
>IOW it is the sense of protecting an object to prevent it from external access.
That's true - I agree that this could be seen in this way - but it looks like a kind of philosophical issue to me. To prove the "common"-way of handling this - I created a C#-sample which shows that C# (I now found a real application for .NET for me ! ;-)) handles the same issue in the way I would expect it...
Liebe Grüsse
Matthias
using System;
namespace ConsoleApplication2
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Test2 lT = new Test2();
Console.WriteLine(lT.GetTest().TestString);
}
}
public class Test
{
public String TestString = "Test";
}
public class Test2
{
protected Test _Test = new Test();
public Test GetTest()
{
return _Test;
}
}
}