|
MrMoo posted:A single question ok, but laboring the point in every permutation of usage is just too much. Having coding standards and following them is more acceptable than C++ rule lawyering that some developers love a bit too much. Using delete this; in a constructor is valid apparently but that does not make it not stupid. You can use it anywhere technically, https://isocpp.org/wiki/faq/freestore-mgmt#delete-this I'm not sure its ever a good idea though? quote:The interviewer was trying to replace class with struct and ask me where it would break. Then thats #define class struct And it should always work.
|
# ¿ Aug 23, 2016 15:33 |
|
|
# ¿ May 9, 2024 22:23 |
|
Plorkyeran posted:It's UB if you include any standard library headers afterwards, and members of classes are allowed to have different name mangling from members of structs. The compiler could also decide to lay out the sections differently. Yes, I meant in your own code compiling your own classes. This is why I screw up interviews! Why can't C++ questions be more like Hashmap vs Hashtable
|
# ¿ Aug 23, 2016 16:05 |
|
MrMoo posted:The interviewer was looking for something in templates, e.g. A struct is a class. Full stop. Take a look at the C++14 standard starting on page 226. You may be surprised at the keywords they use when describing class declarations.
|
# ¿ Aug 23, 2016 20:10 |
|
Unions are also classes if we're talking about C++ trivia. I have no idea why.
|
# ¿ Aug 23, 2016 20:34 |
|
In C++? A surprising amount!
|
# ¿ Aug 24, 2016 01:37 |
|
|
# ¿ May 9, 2024 22:23 |
|
MrMoo posted:I was asked but then followed up with this more trivia type questions, it was really a bit tenuous. They still want to interview me which suggests there are not a lot of C++ people really looking for jobs. There also aren't all that many C++ jobs out there.
|
# ¿ Aug 25, 2016 15:05 |