เส้นทางการเรียนรู้

Struct และ Interface

Struct, method, pointer, interface, embedding, error และ generics

บทเรียน 9 บท · โจทย์ 14 ข้อ

  1. บทเรียน โจทย์ 1 ข้อ Structs Group related values into your own type with named fields.
  2. บทเรียน โจทย์ 2 ข้อ Methods and Receivers Attach functions to a type and choose between value and pointer receivers.
  3. บทเรียน โจทย์ 2 ข้อ Pointers Use & and * to share a value instead of copying it.
  4. บทเรียน โจทย์ 2 ข้อ Interfaces Describe behavior with an interface that any type can satisfy.
  5. บทเรียน โจทย์ 2 ข้อ Struct Embedding and Composition Reuse fields and methods by embedding one struct in another.
  6. บทเรียน โจทย์ 1 ข้อ Temperature Converter Convert between Celsius and Fahrenheit with your own number types.
  7. บทเรียน โจทย์ 2 ข้อ Error Handling Return errors as values, wrap them with context and check them with errors.Is and errors.As.
  8. บทเรียน โจทย์ 1 ข้อ Bank Account with Errors Model deposits and withdrawals that can fail with your own error types.
  9. บทเรียน โจทย์ 1 ข้อ Generics Write one function or type that works with many types using type parameters.