public static void Main() { SimpleStruct ss = new SimpleStruct(); ss.X = 5; ss.DisplayX(); SS si = (SS) ss; si.X = 90; si.DisplayX(); ss = (SimpleStruct) si ; ss.X = 5; ss.DisplayX(); SimpleClass ss1 = new SimpleClass(); ss1.X = 5; ss1.DisplayX(); try { ss1 = (SimpleClass) si ; ss1.X = 5; ss1.DisplayX(); } catch(Exception) { Console.WriteLine("Failed to cast"); } }
public static void Main() { SimpleStruct ss = new SimpleStruct(); ss.X = 5; ss.DisplayX(); SS si = (SS)ss; si.X = 90; si.DisplayX(); ss = (SimpleStruct)si; ss.X = 5; ss.DisplayX(); SimpleClass ss1 = new SimpleClass(); ss1.X = 5; ss1.DisplayX(); try { ss1 = (SimpleClass)si; ss1.X = 5; ss1.DisplayX(); } catch (Exception) { Console.WriteLine("Failed to cast"); } }
public static void Main() { SimpleStruct ss = new SimpleStruct(); ss.X = 5; ss.DisplayX(); }
// Use this for initialization void Start() { feeding_rate = power / defence; SimpleStruct ss = new SimpleStruct(); ss.X = 500; ss.DisplayX(); }
static void Main(string[] args) { SimpleStruct ss = new SimpleStruct(); ss.DisplayX(); Console.ReadLine(); }
public static void Main() { Console.WriteLine("instaniante a ss structure object"); SimpleStruct ss = new SimpleStruct(); Console.WriteLine("Set the integer to 5 in the ss structure object"); ss.X = 5; Console.WriteLine("Call the Displayx function in the ss structure object"); ss.DisplayX(); }
public static void Main() { SimpleStruct ss = new SimpleStruct(); ss.X = 5; ss.DisplayX(); SS si = (SS)ss; si.X = 90; si.DisplayX(); }
public static void Main() { SimpleStruct ss = new SimpleStruct(); ss.X = 5; ss.DisplayX(); }