Created
February 23, 2020 04:15
-
-
Save fjkz/ea602e74b846c8bf4505adf7d275a940 to your computer and use it in GitHub Desktop.
Builder pattern
This file contains hidden or 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 SshClient { | |
SshClient(String user, String host, int port, int timeout) { | |
// ... | |
} | |
SshClient(String user, String host) { | |
this(user, host, 22, 60); | |
} | |
SshClient(String user, String host, int port) { | |
this(user, host, port, 60); | |
} | |
SshClient(String user, String host, int timeout) { // <- compile error | |
this(user, host, 22, timeout); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment