Hello, I just wanted to make sure my logic was correct so I don't waste a bunch of time typing up all this code to find out it doesn't work.
With the given class structure: # UserModel implements IUserModel # ChildUserModel1 extends UserModel implements IUserModel, IChildUserModel # ChildUserModel2 extends UserModel implements IUserModel, IChildUserModel # ChildUserModel3 extends UserModel implements IUserModel, IChildUserModel etc. If I have a class instance where the exact implementation could be any of the above classes, and is determined at run time, would it be safe/correct to define a variable of type IUserModel and then strong type it as either IUserModel or IChildUserModel depending on its expected implementation? For instance: # var user:IUserModel; # user = new UserModel(); # trace( IUserModel(user).someUserProperty ); # user = new ChildUserModel2(); # trace( IChildUserModel(user).someChildUserProperty ); (assuming the properties are defined in the interface of course) Is there a safer/more correct way to accomplish this given that the property always starts off as a UserModel and may or may not become any one of the ChildUserModel classes who share a common interface? note: Any of this can be changed, I just need to be able to have a class that acts as an IChildUserModel when it is one, or as a UserModel when it's not. There is only one kind of UserModel, so I'm not sure if the IUserModel interface is even necessary. I just wasn't sure how to define the variable so it could be either one. Any input or advice will be greatly appreciated. Thanks for your time! ...aaron