3 ms·
In C++ a struct from the start was a class with default public visibility. You can define member function on them.
by vidarh 4y ago
In C++ a struct from the start was a class with default public visibility. You can define member function on them.
- bigtunacan 4y agoYes I'm aware. You can define methods/functions on most (if not all implementations of struct); Ruby's is no exception to this. The parent indicated they didn't understand why both struct/class exist because there is so much overlap. The primary reason is to signal intent. This has largely been lost as the masses just use classes for everything or they use simple data types like hashes.