diff --git a/main.go b/main.go index af5adbe..a95a129 100644 --- a/main.go +++ b/main.go @@ -54,4 +54,5 @@ func main() { pointers.Demo2(numbers) fmt.Println("Numbers in Main", numbers[0]) structs.Demo1() + structs.Demo2() } diff --git a/structs/demo1.go b/structs/demo1.go index 0675115..5ce7ee6 100644 --- a/structs/demo1.go +++ b/structs/demo1.go @@ -11,4 +11,5 @@ type product struct { unitPrice float64 brand string discountRate int -} \ No newline at end of file +} + diff --git a/structs/demo2.go b/structs/demo2.go new file mode 100644 index 0000000..ad3af76 --- /dev/null +++ b/structs/demo2.go @@ -0,0 +1,18 @@ +package structs + +import "fmt" + +type customer struct{ + firstName string + lastName string + age int +} + +func (c customer) save() { + fmt.Println("Has been added : ", c.firstName, c.lastName,c.age) +} + +func Demo2() { + c:= customer{firstName: "Engin", lastName: "Demiroğ", age: 35} + c.save() +} \ No newline at end of file