Re: Public constants and types in class
On 1/27/20 3:05 PM, Herbert wrote: How can a class provide it's users with named constants, enums, types, structs and not just member functions? Just declare them inside the class. They then go inside the class namespace, but are not strictly part of the class instance itself. e.g.: class C { enum Enum { one, two, three} struct S { int x; int y; } } C.Enum e = C.Enum.one; C.S s = C.S(1, 2); // can also access the namespace via an instance: C instance; instance.Enum e = instance.Enum.one; -Steve
Public constants and types in class
How can a class provide it's users with named constants, enums, types, structs and not just member functions?