Reputation: 441
I've a class with protected member from a project of a solution:
public class FPrintImage
{
protected static Byte[] fpImage1;
protected static Byte[] fpImage2;
}
Now I want to access these protected members of the class from a different class of project , which is also the code behind class of a xaml page :
public partial class MainWindow : Window
{
}
Upvotes: 0
Views: 457
Reputation: 314
It is not possible to access protected members of a class.
However, what can be done is derive a subclass from FPrintImage:
public class MyFPrintImage : FPrintImage
{
public static Byte[] getFPImage1()
{
return fpImage1;
}
public static void setFPImage1(Byte[] _fpImage1)
{
fpImage1 = _fpImage1;
}
}
Then you can access the protected members.
EDIT: it is indeed not possible to inherit from two base classes, but you can create an instance of the subclass in the MainWindow class.
Upvotes: 2