Skip to content

Instantly share code, notes, and snippets.

@ilandbt
Created November 1, 2016 09:39
Show Gist options
  • Save ilandbt/910b7774e0a6c6bdd348f0958f12611e to your computer and use it in GitHub Desktop.
Save ilandbt/910b7774e0a6c6bdd348f0958f12611e to your computer and use it in GitHub Desktop.
import UIKit
class Pet {
}
class Cat: Pet {
}
class Dog: Pet {
}
public class Node<T> {
public var value: T
public init(value: T) {
self.value = value
}
}
var list = [Node<Pet>]()
//Error: Cannot convert value of Type Node<Dog> to expected argument type Node<Pet>
list.append(Node<Dog>(value: Dog()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment