I have following code.
class A
{
public void PrintA() {
Console.WriteLine("PrintA() executed");
}
}
class B {
public void PrintB() {
A a = new A();
a.PrintA();
}
}
class Program
{
static void Main(string[] args)
{
B b = new B();
b.PrintB();
}
}
This code works for me. Can we do it a better manner like can we implement design pattern into it because this program has many new keyword. So can we remove new keyword.
Aucun commentaire:
Enregistrer un commentaire