Go (golang) Tutorials - User Types ( Part II - Methods )

preview_player
Показать описание
#golang #go #struct

User Types : - Methods (Behaviors)
-----------------------
1. Creating Methods
2. Receivers
- Function with a Receiver is called as a method
- A method without a Receiver is called as a function
3. Types of Receivers
- Value Receiver
- Pointer Receiver

--------------
package main
import "fmt"
type country struct{
name string
currency string
}
func (c country) display(){ //Method display has no argument but one receiver of type country - Value Receiver
fmt.Println(c)
}
func (c *country) setname(name string){ //Method setname has string arument with a pointer country - Pointer Rec$
}
func main(){
india:=country{"India","INR"}
}
Рекомендации по теме
Комментарии
Автор

hi myself veeranjaneyulu your teaching vedios very much useful for me your way of telling is in a detaild way that healped me to understand the concepts thanks you so much waiting for next vedios could you please upload the next part waiting for your vedios

veeranjaneyuludaddala
join shbcf.ru