On 9/28/20 7:11 AM, Ruby The Roobster wrote:
For example:

class test {}
class T {
auto c = new test();
}

Any way to tell if an object of type test is a member of object T? I don't want to use the name of the member variable. I just want to know if this works in general. Why am I asking this? Because I need it to develop this Multiple Alias This project I am working on(basically just mashing all the functions into a class and then using the class with alias this)

No. The type of e.g. T.c is the same as the type of some other instance of `test`.

Armed only with a class reference to a `test` object, you cannot tell where it is referenced from.

I think you need to be more specific about what you want to do. I have a feeling you are not understanding how classes work in D (they are not stored inside an object or struct, but rather on the heap, and the member variable is simply a reference to that item).

-Steve

Reply via email to