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");
        }
        

    }
Пример #2
0
    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");
        }
    }
Пример #3
0
    public static void Main()
    {
        SimpleStruct ss = new SimpleStruct();

        ss.X = 5;
        ss.DisplayX();
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     feeding_rate = power / defence;
     SimpleStruct ss = new SimpleStruct();
     ss.X = 500;
     ss.DisplayX();
 }
Пример #5
0
        static void Main(string[] args)
        {
            SimpleStruct ss = new SimpleStruct();

            ss.DisplayX();
            Console.ReadLine();
        }
Пример #6
0
 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();
 }
Пример #7
0
    public static void Main()
    {
        SimpleStruct ss = new SimpleStruct();

        ss.X = 5;
        ss.DisplayX();

        SS si = (SS)ss;

        si.X = 90;
        si.DisplayX();
    }
Пример #8
0
 public static void Main()
 {
     SimpleStruct ss = new SimpleStruct();
     ss.X = 5;
     ss.DisplayX();
 }