Like all OOP languages, Silicon provides a keyword for testing if an instance is an instance of a certain class: is. This is demonstrated in the example below:
class Foo {
}
class Bar {
}
main {
const foo = new Foo()
print(foo is Foo) //Prints true
print(food is Bar) //Prints false
}
Casting
Also like all OOP languages, Silicon features polymorphism
Type Checking
Like all OOP languages, Silicon provides a keyword for testing if an instance is an instance of a certain class:
is
. This is demonstrated in the example below:Casting
Also like all OOP languages, Silicon features polymorphism