课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

R7 OOP: Class Inheritance

R7 OOP: Class Inheritance

- We've been talking about the new R7 object oriented programming structures being added to base R. This week, let's talk about the concept of inheritance where one class picks up properties from a parent class. Now, in the code that I've provided, lines six, seven, and eight are the way to currently install the R7 package. You'll notice it comes from Github. In the future, this will probably appear in Cran or as part of the base R installation. For right now, you can use six, seven, and eight to install this package. I've already done that. Let's start with line 11 where I'm creating a new class called base class. This base class has properties called BC name and A value. In line 15 is something very important. I've declared abstract equal to true. Now, before I go any further, I'm going to go ahead and run line 11, 12, 13, 14, and 15 and that will create this base class. Now, why did I define this with abstract equals…

内容