예제 #1
0
        public static void EX1()
        {
            Variavel A = new Variavel("A");
            Variavel B = new Variavel("B");
            Variavel C = new Variavel("C");

            AbstractExpression soma = new SomarExpression(A, new SomarExpression(B, C));

            Contexto contexto = new Contexto();

            contexto.Assign(A, 5);
            contexto.Assign(B, 15);
            contexto.Assign(C, 5);

            Console.WriteLine(soma.Interpret(contexto));
        }
예제 #2
0
 public override int Interpret(Contexto ctx)
 {
     return ctx.Lookup(Nome);
 }
 public override int Interpret(Contexto ctx)
 {
     return _operator1.Interpret(ctx) + _operator2.Interpret(ctx);
 }
 public abstract int Interpret(Contexto ctx);
 public abstract int Interpret(Contexto ctx);