Created
September 5, 2016 07:19
-
-
Save tyoshikawa1106/fe3fb4dd20a0a5bfa4651cbee1facd5b to your computer and use it in GitHub Desktop.
Apexとインターフェイスクラス
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
public interface InterfaceSample { | |
String sampleMethod1(); | |
String sampleMethod2(Integer num); | |
} |
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
public with sharing class ImplementsSample implements InterfaceSample { | |
public String sampleMethod1() { | |
return 'サンプル1'; | |
} | |
public String sampleMethod2(Integer num) { | |
return 'サンプル2 : ' + String.valueOf(num); | |
} | |
} |
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
public with sharing class InterfaceSampleRun { | |
/** | |
* コンストラクタ | |
*/ | |
public InterfaceSampleRun() { | |
ImplementsSample sample = new ImplementsSample(); | |
String result1 = sample.sampleMethod1(); | |
String result2 = sample.sampleMethod2(1000); | |
System.debug(result1); | |
System.debug(result2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment