extend: Extend a Type upon a (Proto)type

View source: R/core.R

extendR Documentation

Extend a Type upon a (Proto)type

Description

Used only inside a type definition

Usage

extend(prototype)

Arguments

prototype

Q7type; function

Value

localized Q7type; function

Examples


Type1 <- type(function(arg1){
    val1 <- arg1
    get_val1 <- function(){
         val1
    }
}, "Type1")

Type2 <- type(function(arg1, arg2){
    extend(Type1)(arg1)
    val2 <- arg2
    get_val2 <- function(){
        val2
    }
}, "Type2")

myType2 <- Type2("foo", "bar")

myType2$get_val1()
myType2$get_val2()


iqis/foo documentation built on March 27, 2022, 8:43 p.m.