Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
itisdruzhkov authored Jan 17, 2024
1 parent 6d8098a commit 01f5f99
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Struct.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import "fmt"

type Television struct {
Brand string
Model string
Channel int
}

func (tv *Television) SetChannel(channel int) {
tv.Channel = channel
}

func (tv *Television) GetChannel() int {
return tv.Channel
}

func (tv *Television) Display() {
fmt.Printf("Телевизор %s %s находится на канале %d\n", tv.Brand, tv.Model, tv.Channel)
}

func main() {
tv := Television{
Brand: "Samsung",
Model: "QLED",
Channel: 1,
}

tv.Display()
tv.SetChannel(5)
tv.Display()
}

0 comments on commit 01f5f99

Please sign in to comment.