Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class test{
//takes package parent class
init(package: Package,price :Int64) {
do{
try 8 * 100/package.setPrice(price:price)
print("done")
}catch {
print("price value must be greater than 0 _ \(price) ")
}
}
}
test(package: Package(),price: 10) //no issues
test(package: Pro(),price: 999) //error //strentened pre conds
test(package: Basic(),price: 999) //error //strentened pre conds
test(package: Basic(),price: 999) //error //weakened post condition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment