[Rcpp-devel] inheritance

Richard Downe richard-downe at uiowa.edu
Wed Oct 5 02:53:13 CEST 2011


Since I'm a bit of a glutton for punishment, and I would like to see 
this feature...are there major technical hurdles as to why this has not 
been implemented (e.g., I should just give up and find another way), or 
is it more just a "nobody's gotten around to it because it's good enough 
how it is", where I might be able to change the situation?
--rd

On 10/04/2011 05:52 PM, Dirk Eddelbuettel wrote:
> On 4 October 2011 at 17:29, Richard Downe wrote:
> | I'm fairly sure I'm not doing anything at all with multiple
> | inheritance.  This is a single instance of single inheritance.
>
> My bad, sloppy language here.
>
> I think I meant to say that Rcpp modules does what is in the vignette: easy
> access to simple data structures, so no inheritance whatsoever at the moment.
> That is of course a bit of a restriction...
>
> | I will peruse the list; what I had seen in my searches so far had
> | suggested no conclusive answer.
>
> Thanks. I also inadvertently dropped a 'may' in my reply.
>
> Dirk
>
> | --rd
> |
> | On 10/04/2011 05:23 PM, Dirk Eddelbuettel wrote:
> |>  Richard,
> |>
> |>  Welcome!
> |>
> |>  On 4 October 2011 at 16:29, Richard Downe wrote:
> |>  | Is it possible to have a class wrapped in rcpp inherit directly from a
> |>  | superclass?
> |>  | E.g., I have
> |>  |
> |>  |      class_<tcfaIndices>( "tcfaIndices" )
> |>  |
> |>  |          .constructor<long>()
> |>  |
> |>  |          .method("SetTCFADefinition",&tcfaIndices::SetTCFADefinition)
> |>  |          .method("getTCFALabels",&tcfaIndices::getTCFALabels)
> |>  |
> |>  |          ;
> |>  |
> |>  | and
> |>  |
> |>  |      class_<morphologyIndices>( "morphologyIndices" )
> |>  |
> |>  |      .constructor<long>()
> |>  |
> |>  |          .method("getCentroidLumen",&morphologyIndices::getCentroidLumen)
> |>  |          .method("getCentroidAdventitia",
> |>  |&morphologyIndices::getCentroidAdventitia)
> |>  |
> |>  |          ;
> |>  |
> |>  | where the c++ class tcfaIndices inherits from c++ class morphologyIndices.
> |>  | I get compiler errors that suggest this is impossible (they seem to show
> |>  | up surrounding the cascade of calls to constructors), but was curious as
> |>  | to if there's a way to do this (other than, say, introducing 1 more
> |>  | level of abstraction, and then inserting a member variable rather than a
> |>  | parent class...)
> |>
> |>  Rcpp itself is open to mulitple inheritance.
> |>
> |>  Rcpp modules, which your question appears to be concerned with, currently
> |>  cannot as discussed a few times on this list.  You find perusing the list
> |>  archives informative.
> |>
> |>  Hth, Dirk
> |>
> |
>



More information about the Rcpp-devel mailing list