CBook-class: Class '"CBook"'

Description Objects from the Class Slots Methods Examples

Description

A simple demonstration of how to write a S4 class.

Objects from the Class

Objects can be created by calls of the form new("CBook", ...).

Slots

title:

Object of class "character" ~~

author:

Object of class "character" ~~

year:

Object of class "numeric" ~~

Methods

bookTitle

signature(object = "CBook"): ...

coerce

signature(from = "CBook", to = "list"): ...

show

signature(object = "CBook"): ...

title<-

signature(x = "CBook"): ...

Examples

1
2
3
4
5
6
7
8
9
showClass("CBook")
b1 <- CBook("C pgm", "Auther Lee", 1998); 
bt <- bookTitle(b1); 
str(b1) 
print(bt) 
title(b1) <- "Cpp pgm" 
str(b1) 
print(as(b1, "list")) 
show(b1) 

toyRpkg documentation built on May 2, 2019, 5:49 p.m.