Skip to content

Interfaces

sancalle edited this page Oct 14, 2022 · 4 revisions

Typescript

interface Animal {
    name: string;
    isDomestic(): boolean;
}

C#

namespace Codeverter
{
    public interface IAnimal
    {
        string Name { get; set; }
        bool IsDomestic();
    }
}

GO

package codeverter

type Animal interface {
	IsDomestic() bool
}

Visual Basic

Namespace Codeverter
    Public Interface IAnimal
        Property Name As String
        Function IsDomestic() As Boolean
    End Interface
End Namespace

Inheritance

Typescript

interface Animal {
    name: string;
    isDomestic(): boolean;
}

interface Feline extends Animal {
    purr(): void;
}

C#

namespace Codeverter
{
    public interface IAnimal
    {
        string Name { get; set; }
        bool IsDomestic();
    }

    public interface IFeline : IAnimal
    {
        void Purr();
    }
}

GO

package codeverter

type Animal interface {
	IsDomestic() bool
}

type Feline interface {
	Animal
	Purr()
}

Visual Basic

Namespace Codeverter
    Public Interface IAnimal
        Property Name As String
        Function IsDomestic() As Boolean
    End Interface

    Public Interface IFeline : IAnimal
        Sub Purr()
    End Interface
End Namespace
Clone this wiki locally