Last active
January 18, 2023 03:44
-
-
Save reetasingh/85a9f8a1370ae9e0f203369a3c2e0942 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type Circle struct { | |
r float64 | |
} | |
func (c *Circle) area() float64 { | |
return math.Pi * c.r * c.r | |
} | |
func main() { | |
c := new(Circle) | |
c.r = 1.2 | |
fmt.Println(c.area()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment