Created
January 26, 2023 07:43
-
-
Save arriqaaq/cd43b48e7bae572f2ad5d54d5e5c98cd 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
| type Person struct { | |
| Name string | |
| Age int | |
| } | |
| func (p *Person) Greet() string { | |
| return "Hello, my name is " + p.Name | |
| } | |
| func (p *Person) Copy() *Person { | |
| return &Person{ | |
| Name: p.Name, | |
| Age: p.Age, | |
| } | |
| } | |
| originalPerson := &Person{Name: "John", Age: 30} | |
| clonedPerson := originalPerson.Copy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment