Skip to content

Instantly share code, notes, and snippets.

@tyoshikawa1106
Created September 5, 2016 07:19
Show Gist options
  • Save tyoshikawa1106/fe3fb4dd20a0a5bfa4651cbee1facd5b to your computer and use it in GitHub Desktop.
Save tyoshikawa1106/fe3fb4dd20a0a5bfa4651cbee1facd5b to your computer and use it in GitHub Desktop.
Apexとインターフェイスクラス
public interface InterfaceSample {
String sampleMethod1();
String sampleMethod2(Integer num);
}
public with sharing class ImplementsSample implements InterfaceSample {
public String sampleMethod1() {
return 'サンプル1';
}
public String sampleMethod2(Integer num) {
return 'サンプル2 : ' + String.valueOf(num);
}
}
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