Skip to content

How to implement Callbacks in Fusion language? #127

Closed Answered by pfusik
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Another example:

public abstract class ThreeIntsFull
{
    protected abstract void OnFull!();
}

public class ThreeIntsContainer
{
    int[3] Content;
    int Count = 0;

    public void Append(int value, ThreeIntsFull! fullCallback)
    {
        if (Count >= 3)
            fullCallback.OnFull();
        else
            Content[Count++] = value;
    }
}

or:

public abstract class ThreeIntsContainer
{
    int[3] Content;
    int Count = 0;
    protected abstract void OnFull!();

    public void Append(int value)
    {
        if (Count >= 3)
            OnFull();
        else
            Content[Count++] = value;
    }
}

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
10 replies
@BenBE
Comment options

@pfusik
Comment options

@BenBE
Comment options

@ghost
Comment options

@pfusik
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants