Created
December 2, 2020 20:22
-
-
Save matiasdim/8a46584ab76d6fea1655b442204f0375 to your computer and use it in GitHub Desktop.
Single-Responsability
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 Employee { | |
let name: String | |
let emailAddress: EmailAddress | |
init(name: String, emailAddress: EmailAddress) { | |
self.name = name | |
self.emailAddress = emailAddress | |
} | |
func getInfo() -> String { | |
return "Employee named \(name) has email \(emailAddress.email)" | |
} | |
} | |
class EmailAddress { | |
let email: String | |
init(email: String) { | |
self.email = email | |
} | |
func validate() -> Boo l{ | |
// Code that validates email | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment