Skip to content

Commit

Permalink
interface update
Browse files Browse the repository at this point in the history
  • Loading branch information
jaringankantor committed Oct 15, 2021
1 parent 5bc2f17 commit 10d7bbf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions biodata.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ func TampilData() {
func (pegawai Pegawai) SelamatDatang(nama string) {
fmt.Println("Selamat datang", nama, "giat bekerja ya pak", pegawai.Nama)
}

func AnonymousDataOrtu() {
OrangTua := struct {
Usia int8
NamaOrtu string
Hidup bool
}{
Usia: 63,
NamaOrtu: "Syahroni",
Hidup: true,
}

fmt.Println(OrangTua)
}
17 changes: 17 additions & 0 deletions kalkulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ package module

import "fmt"

type PersegiInterface interface {
Keliling() int
Luas() int
}

type InputPersegi struct {
a, b int
}

func (in InputPersegi) Keliling() int {
return (in.a + in.b) * 2
}

func (in InputPersegi) Luas() int {
return in.a * in.b
}

func About() {
fmt.Println("Ini adalah fungsi kalkulator")
}
Expand Down

0 comments on commit 10d7bbf

Please sign in to comment.