using System;
public class Program
{
public class ReadOnlyModel
}
public class Model : ReadOnlyModel
public void Write()
Console.WriteLine("Write operation performed!");
public static void Main()
var readOnlyModel = new ReadOnlyModel();
((Model)readOnlyModel).Write(); // Run-time exception: Unable to cast object of type 'ReadOnlyModel' to type 'Model'.
//Model model = readOnlyModel; // Compilation error: Cannot implicitly convert type 'Program.ReadOnlyModel' to 'Program.Model'.
//model.Write();
//readOnlyModel.Write(); // Compilation error: 'Program.ReadOnlyModel' does not contain a definition for 'Write'