Questions tagged [struct]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1
votes
1answer
207 views

Few unusual C/C++ declarations

I came across this Enum and Struct declarations in a project supposedly done by an expert. The declarations / definitions are little different than what im used to so far. enum EnumKeys { KEY_MENU ,...
4
votes
0answers
191 views

Rust and lifetime elision rules for structs?

In the Rust documentation, under the structs section, they give this example of how structs need lifetimes when they contain references: struct Foo<'a> { x: &'a i32, } because We ...
175
votes
5answers
149k views

When do you use a struct instead of a class? [closed]

What are your rules of thumb for when to use structs vs. classes? I'm thinking of the C# definition of those terms but if your language has similar concepts I'd like to hear your opinion as well. I ...