Skip to content

Commit a052343

Browse files
committed
Allow child classes to change default value of parent properties
closes #467
1 parent b5cf389 commit a052343

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/constructor.R

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ constructor_args <- function(parent, properties = list()) {
6161
if (is_class(parent) && !parent@abstract) {
6262
# Remove any parent properties; can't use parent_args() since the constructor
6363
# might automatically set some properties.
64-
self_arg_nms <- setdiff(self_arg_nms, names2(parent@properties))
64+
parent_prop_nms <- names2(parent@properties)
65+
overridden <- intersect(self_arg_nms, parent_prop_nms)
66+
for(name in overridden)
67+
parent_args[[name]] <- prop_default(properties[[name]])
68+
69+
self_arg_nms <- setdiff(self_arg_nms, parent_prop_nms)
6570
}
6671

6772
self_args <- as.pairlist(lapply(

0 commit comments

Comments
 (0)