mirror of
				https://github.com/SourceFellows/gobuch.git
				synced 2025-11-04 15:46:17 +01:00 
			
		
		
		
	initial import
This commit is contained in:
		
							
								
								
									
										23
									
								
								golang-language-samples/pointer-receiver/pointer.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								golang-language-samples/pointer-receiver/pointer.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Person struct {
 | 
			
		||||
	alter int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p *Person) Alter() int {
 | 
			
		||||
	return p.alter
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p *Person) GeburtstagFeiern() {
 | 
			
		||||
	p.alter = p.alter + 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	p := Person{5}
 | 
			
		||||
	p.GeburtstagFeiern()
 | 
			
		||||
	fmt.Println(p.Alter())
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user