Reputation: 261
This is basically the opposite of what I was trying to do earlier. I just need to know how to change a subclass variable from it's superclass. So if I were to make an object in a class how would I dynamically change a variable in that object from the original class that I made it in?
Suppose this is the main function of my main class:
public function MAIN()
{
new OBJECT_square().CREATE(this,100,100);
OBJECT_square.X = 40;
}
Changing the X value in this way is not working. I realize I can set/change the X value when I make a new subclass but I need to be able to change it as I go. I also realize I can change it from within the subclass but this isn't what I want.
Upvotes: 1
Views: 194
Reputation: 7061
Your terminology is a bit screwed up. Rather than super- or subclass you actually mean parent and child class, or more precisely parent container and child component.
Anyway your problem is unrelated to this. What you need to do is access the new instance through a temporary var
. Here's the fix:
public function MAIN()
{
var square:OBJECT_square = new OBJECT_square();
square.CREATE(this,100,100);
square.X = 40;
}
Upvotes: 1