1234567891011121314151617181920212223 |
- package biz
- import "fmt"
- type PhoneNumber struct {
- Phone string
- AreaCode string
- }
- func NewPhoneNumber(phone, areaCode string) *PhoneNumber {
- return &PhoneNumber{
- Phone: phone,
- AreaCode: areaCode,
- }
- }
- func (p PhoneNumber) String() string {
- return fmt.Sprintf("%s %s", p.AreaCode, p.Phone)
- }
- func (p PhoneNumber) Eq(p2 *PhoneNumber) bool {
- return p.Phone == p2.Phone && p.AreaCode == p2.AreaCode
- }
|