Skip to content

Instantly share code, notes, and snippets.

View Cscotttaakan's full-sized avatar

Craig Scott Cscotttaakan

  • CA, USA
View GitHub Profile
@Cscotttaakan
Cscotttaakan / TypeErasure.swift
Created August 10, 2018 03:59 — forked from gwengrid/TypeErasure.swift
Example of type erasure with Pokemon
class Thunder { }
class Fire { }
protocol Pokemon {
typealias PokemonType
func attack(move:PokemonType)
}
struct Pikachu: Pokemon {
typealias PokemonType = Thunder