Quantcast
Channel: GUJ - Tópicos com a tag java
Viewing all articles
Browse latest Browse all 17410

Instanciar classe abstrata em método no C# igual no Java

$
0
0

@Mint escreveu:

O problema que estou tendo é um tanto quanto esquisito, preciso disso em C#:

Classe MethodStrategy

public abstract class MethodStrategy {
    public abstract void strategy();
}

Classe Teste
public class Test {
   public void test(MethodStrategy methodStrategy) {
       Thread thr = new Thread(() -> {
           methodStrategy.strategy();
       });
       thr.start();
   }
}

Classe Test2
public class Test2 {
    public Test2() {
        Test t = new Test();
        t.test(new MethodStrategy() {
            @Override
            public void strategy() {
                //TODO
            } 
        });
    }
}

Este sistema funciona perfeitamente em Java queria saber se tem uma forma de fazer isso em C#.

Mensagens: 1

Participantes: 1

Ler tópico completo


Viewing all articles
Browse latest Browse all 17410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>