我有一个基类和两个派生类,这两个派生类也共享着两个属性。我想从基类中访问这些属性。怎么做?以下是示例:
public abstract class ClientEngine
{
public void SaveFile(string fileName);
{
//Not implemented, I get error here because I don't know how to access Inherited class properties
if (FileStorage != null))
File.WriteAllBytes(fileName, FileStorage);
}
}
public interface IEngineEntity
{
byte[] FileStorage { get; set; }
}
public class MyEntity1 : ClientEngine, IEngineEntity
{
public string MyProperty1 {get; set;}
public string MyProperty2 {get; set;}
public byte[] FileStorage { get; set; }
}
public class MyEntity2 : ClientEngine, IEngineEntity
{
public string MyProperty3 {get; set;}
public string MyProperty4 {get; set;}
public byte[] FileStorage { get; set; }
}