class Rectangle {
var length = 0
var width = 0
init(length: Int, width: Int) { // Constructor
self.length = length
self.width = width
}
var Area: Int{
return length*width
}
func getArea() -> Int {
return length*width
}
}
class Circle {
var radius = 0.0
init(radius: Double) { // Constructor
self.radius = radius
}
var Area: Double{
return 3.14*(radius*radius)
}
func getArea() -> Double {
return 3.14*(radius*radius)
}
}
let rect1 = Rectangle(length: 10, width: 10)
print(rect1.Area) // access the property
print(rect1.getArea())
let circ1=Circle(radius:12.0)
print(circ1.Area)
print(circ1.getArea())