How can I cast a user-defined handle class object to a subclass object and have all handles of the original object point to the new subclass object?

3 views (last 30 days)
Hi all,
I have an object of a superclass and a collection of handles all of which refer to this object. Given this scenario I need to be able to cast the handle object to a subclass (to which end I can implement a converter method) such that all handles that previously referred to the original superclass object now point to the subclass object to which the superclass object has been casted.
In other words, I would like to be able to cast objects much like in C++ such that all pointers that pointed to the object before the casting operation has been applied also point to this object afterwards.
Thanks - Fabian
  1 Comment
Matt J
Matt J on 2 Dec 2012
Edited: Matt J on 2 Dec 2012
I think you need to show example code and clarify what "a collection of handles all of which refer to this object" means.
Is the superclass in question a handle class or a value class? If the handle objects you speak of are not objects of the superclass itself, how can they "refer" to an object of that class?

Sign in to comment.

Answers (0)

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!