Hello,
Please help me in my query below:
Code snippet 1:
Employee *e1 = new Employee(this);
e1->setX();
e1->setY();
Code snippet 2:
Employee e1 = new Employee();
e1->setX(this);
e1->setY(this);
"this" can be anything. Example, this code is present in a method of another class say Organization. so, "this" is an object of type organization.
Question:
1. Which one is a better approach?
2. Is this a an example of strong / weak coupling. Which one is a tight coupling and which one is the loose coupling?