in c++ instead of class ?
I use class over struct when i need to set some variable to private or protected.
classes and structs are the same except member variables are private in classes by default and public in structs by default. You can use these interchangeably but usually structs are used for plain data types and classes for anything complex
Thank you very much. Okay. Thank you i understood. But what about low level programming with poo ( class )? for example, writing an os. It's preferable, for more power, to use c-style programming or modern c++ style ?
Thank you. Plain data => struct and anything complex data => class.
Keep in mind that it is just a convention. You can use struct for complex data structures and classes for simple data as well.
Обсуждают сегодня