What data types can be a member of a structure or class?

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
4 posts • Page 1 of 1
tgdannemiller
Posts:23
Joined: Thu Apr 21, 2016 3:29 pm

What data types can be a member of a structure or class?

Post by tgdannemiller »

I've created a structure, and one of the members is a mixed type. There are no errors, but when I create an instance of the structure and assign a value to the mixed type member, it always reads back as empty or no value. I also tried an anytype member with the same results. Are there restrictions on what data types can be used as members of a structure? I looked in the help but couldn't find anything addressing that topic.

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: What data types can be a member of a structure or class?

Post by mkoller »

That's a bug. I could reproduce it and will create a bug tracker entry

ozangor
Posts:44
Joined: Thu Sep 22, 2011 2:57 pm

Re: What data types can be a member of a structure or class?

Post by ozangor »

In addition to that, it is not possible to use a class as a member of its own.

Code: Select all

class MyClass()
{
  MyClass obj;
}

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: What data types can be a member of a structure or class?

Post by mkoller »

Correct, you can't have your complete own class inside your own class ... but I assume that is not what you really want.
Maybe you are thinking just about a _pointer_ to your own class, e.g. the following works:

Code: Select all


class Node
{
  public shared_ptr next;
};

main()
{
  shared_ptr root = new Node;

  root.next = new Node;
  root.next.next = new Node;

  DebugN(root);
}


4 posts • Page 1 of 1