Shape interface

Quay lại bài học

Shape interface

Lập trình

Tạo interface Shape và implement các hình

Tạo: 1. Interface Shape với Area() và Perimeter() 2. Struct Circle implement Shape 3. Struct Rectangle implement Shape 4. Function in thông tin của Shape

Code mẫu
package main

import "fmt"

type Shape interface {
    Area() float64
    Perimeter() float64
}

// Viết code ở đây