1
Reply

Suppose if we have two classes: class A and Class B. How will you make it tightly coupled and then what you should do to make it decoupled.

Gul Md Ershad

Gul Md Ershad

8y
558
0
Reply

    Tight Coupled Code:public class A { }public class B {private A _a;public A(){_a = new A();} }In the above code, B class has dependency on A class.Decoupled Code:Program to Interface is the best way to decouple the code. I will take and Interface and use Dependency Injection specially Constructor Injection.