# Golang Program to Find the Area of a Rectangle Using Classes

Go ProgrammingServer Side ProgrammingProgramming

To find the area of a rectangle using classes, we can take following Steps

• Define a struct with rectangle properties such as breadth and length.
• Define a method to calculate the area of the rectangle.
• In the main method, instantiate an object of rectangle.
• Call the struct method, i.e., Area, to calculate the area of the rectangle.
• Print the area of the rectangle.

## Example

Live Demo

package main
import (
"fmt"
)
type Rectangle struct {
len int
}
func (r *Rectangle)Area() int{
}
func main(){
rectangle := Rectangle{
}
Area of the rectangle: {10 8} is: 80