Busy writing an infix to postfix converter.(I'm a strange guy. I like to do those things from time to time...)
I have a class Expression which is in essence :
[StructLayout(LayoutKind.Explicit)] //in c/c++ this is a union
public struct Valoper
{
[FieldOffset(0)]
public int Value;
[FieldOffset(0)]
public Oper Operand;
}
public Queue<Valoper> RPN = new Queue<Valoper>();
public Queue<Valoper> InfixToPostfix(string expr)
{
//change expr to postfix
return RPN;
}
Btw wonder why they left out the union keyword in C#.
I found this "way" to do it in C# on MSDN.
In my Main I have :
Expression E = new Expression();
Queue<Expression.Valoper> Output = E.InfixToPostfix(InputStr);
The last line gives me the error message
Error 1 Cannot implicitly convert type 'System.Collections.Generic.Queue<ConsoleInfixToPostfix.Expression.Valoper>' to 'System.Collections.Generic.Queue<Valoper>
I'm using VS 2008 Express C# here.
What am I doing wrong? Any help would be nice.