Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for Hypotenuse (0.07 sec)

  1. src/encoding/gob/example_interface_test.go

    package gob_test
    
    import (
    	"bytes"
    	"encoding/gob"
    	"fmt"
    	"log"
    	"math"
    )
    
    type Point struct {
    	X, Y int
    }
    
    func (p Point) Hypotenuse() float64 {
    	return math.Hypot(float64(p.X), float64(p.Y))
    }
    
    type Pythagoras interface {
    	Hypotenuse() float64
    }
    
    // This example shows how to encode an interface value. The key
    // distinction from regular types is to register the concrete type that
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 02 00:13:47 UTC 2016
    - 2.1K bytes
    - Viewed (0)
Back to top