Advertisement
Tarusov

Untitled

Apr 26th, 2024
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.24 KB | None | 0 0
  1. int Method(IInterface obj) {
  2.   return obj.Calc();
  3. }
  4.  
  5. public struct S1 : IInterface {}
  6. public struct S2 : IInterface {}
  7.  
  8. void Update() {
  9.   Method(new S1());
  10.   …
  11.   Method(new S2());
  12. }
  13.  
  14. interface IInterface {
  15.   int Calc();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement