C++ Classes/Structures

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • variable.member_var = constant;
  • variable.member_function();
  • variable_pointer->member_var = constant;
  • variable_pointer->member_function();

Remarks

Note that the only difference between the struct and class keywords is that by default, the member variables, member functions, and base classes of a struct are public, while in a class they are private. C++ programmers tend to call it a class if it has constructors and destructors, and the ability to enforce its own invariants; or a struct if it's just a simple collection of values, but the C++ language itself makes no distinction.



Got any C++ Question?