Last active
May 16, 2020 16:02
-
-
Save vineeth030/75c48c360ba067dbfaa066d763542321 to your computer and use it in GitHub Desktop.
Tightly coupled class example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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