Last active
March 30, 2018 19:16
-
-
Save iamcrypticcoder/358b686b3c93405c4b0f4738caa426bc to your computer and use it in GitHub Desktop.
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
import Foundation | |
protocol GraphicsAPI { | |
func drawRectangle(_ x: Int, _ y: Int, _ width: Int, _ height: Int) | |
func drawCircle(_ x: Int, _ y: Int, _ radius: Int) | |
} | |
class DirectXAPI : GraphicsAPI { | |
func drawRectangle(_ x: Int, _ y: Int, _ width: Int, _ height: Int) { | |
print("Rectangle drawn by DirectXAPI API"); | |
} | |
func drawCircle(_ x: Int, _ y: Int, _ radius: Int) { | |
print("Circle drawn by DirectXAPI API"); | |
} | |
} | |
public class OpenGLAPI : GraphicsAPI { | |
func drawRectangle(_ x: Int, _ y: Int, _ width: Int, _ height: Int) { | |
print("Rectangle drawn by OpenGL API") | |
} | |
func drawCircle(_ x: Int, _ y: Int, _ radius: Int) { | |
print("Circle drawn by OpenGL API") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment