Skip to content

Instantly share code, notes, and snippets.

@vineeth030
Last active May 16, 2020 16:02
Show Gist options
  • Save vineeth030/75c48c360ba067dbfaa066d763542321 to your computer and use it in GitHub Desktop.
Save vineeth030/75c48c360ba067dbfaa066d763542321 to your computer and use it in GitHub Desktop.
Tightly coupled class example
class Student {
private $studentName;
public __construct($studentName){
$this->studentName = $studentName;
}
}
class School {
private $student;
private $schoolName;
public __construct($schoolName, $studentName){ // Here using $studentName in School scope makes School class tightly coupled.
$this->schoolName = $schoolName;
$this->student = new Student($studentName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment