Archived

This forum has been archived. Please start a new discussion on GitHub.

Struct - inheritance

Hi there,

Does Slice supports structs inheritance?
We have quite a bit a number of structs that holds various data and we are looking to add our versioning to that. It will be nice If we can do something like that:

struct RecordV1 {
int x;
int y;
}

struct RecordV2 extends RecordV1 {
int z;
}

Thanks,
Razvic

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Slice structs do not support inheritance. You could use classes though instead.
    class RecordV1 {
        int x;
        int y;
    };
    
    class RecordV2 extends RecordV1 {
        int z;
    };