Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Class Attribute an object whose reference is not known until runtime

Former Member
0 Likes
408

Hi,

I want to have an attribute R_OBJECT of a class. I don't know what class this refers until runtime and i want to set it in the constructor.

How do I define R_OBJECT and how do I assign a class to it dynamically?

Thanks,

Tristan

1 ACCEPTED SOLUTION
Read only

thomasalexander_ritter
Product and Topic Expert
Product and Topic Expert
0 Likes
375

If you do not know the type during compile time just use the most general type possible.

R_OBJECT type ref to object.

Define it as a parameter in the class constructor and you can use any object when calling the constructor.

cheers

Thomas

Hi,

I want to have an attribute R_OBJECT of a class. I don't know what class this refers until runtime and i want to set it in the constructor.

How do I define R_OBJECT and how do I assign a class to it dynamically?

Thanks,

Tristan

1 REPLY 1
Read only

thomasalexander_ritter
Product and Topic Expert
Product and Topic Expert
0 Likes
376

If you do not know the type during compile time just use the most general type possible.

R_OBJECT type ref to object.

Define it as a parameter in the class constructor and you can use any object when calling the constructor.

cheers

Thomas