Title:
Properties defined in parent class should be inherited as variables of subclass
| View in TrackerStatus/Resolution/Reason: To Fix//Investigate
Reporter/Name(from Bugbase): Ross McMahon / Ross McMahon ()
Created: 04/06/2017
Versions: 11.0
Failure Type: Enhancement Request
Found In Build/Fixed In Build: 11+ /
Priority/Frequency: Normal / Some users will encounter
Locale/System: / Platforms All
Vote Count: 7
Problem Description: When extending objects, any properties defined in the parent should be inherited as variables of the child, as when properties are defined in the child they are put into the variables scope - inherited ones are not.
Steps to Reproduce:
parent.cfc:
component name="parentClass" accessors="true"{
property name="id" type="numeric" default=0;
}
child.cfc:
component name="childClass" accessors="true" extends="parentClass"{
public string function example(){
writeDump(variables.id);
abort;
}
}
var child = new childClass();
child.example();
Actual Result: Element ID is undefined in variables
Expected Result: 0
Any Workarounds: Explicitly setting variables.id = getID() in parentClass constructor method. Or using Lucee, which inherits correctly.
Attachments:
Comments: