%gt%.bandicoot_oop {bandicoot}R Documentation

S3 method of performing the greater than operator of a bandicoot_oop object

Description

This function performs the greater than operator using the ..gt..() method. If it is not applicable, error will be raised.

Usage

## S3 method for class 'bandicoot_oop'
x %gt% y

Arguments

x

bandicoot_oop object.

y

Object.

Value

A Boolean value.

Examples

NAME <- new_class(class_name = "NAME")
name <- NAME$instantiate
register_method(NAME,
                ..init.. = function(first_name, last_name) {
                  self$first_name = first_name
                  self$last_name = last_name
                })
register_method(NAME,
                ..gt.. = function(y) {
                  if (self$last_name == y$last_name) {
                    return(self$first_name > y$first_name)
                  }
                  return(self$last_name > self$last_name)
                })

patrick <- name("Patrick", "Li")
james <- name("James", "Li")
patrick %gt% james


[Package bandicoot version 1.0.0 Index]