2
1
Fork 0

added documentation for struct embeddings

main^2
Sebastian Steger 2025-10-13 12:40:02 +02:00
parent a74265e4dc
commit c0344f2d23
1 changed files with 4 additions and 4 deletions

View File

@ -11,12 +11,12 @@ func (p Person) Say() {
} }
type Student struct { type Student struct {
Person Person //struct Person is embedded
Semester int Semester int
} }
type Teacher struct { type Teacher struct {
Person Person //struct Person is embedded
Subject string Subject string
} }
@ -30,9 +30,9 @@ func main() {
max.Say() max.Say()
daniel.Say() daniel.Say() //can be invoked directly on Student
sebastian.Say() sebastian.Say() //can be invoked directly on Teacher
max = sebastian.Person max = sebastian.Person