What is the difference between struct and class in C++?

Question

can you help me with this question

Answer ( 1 )

    0
    2025-02-22T06:12:43+00:00
    • struct: Members are public by default.
    • class: Members are private by default.

    Example:

    struct A { int x; }; // x is public

    class B { int y; }; // y is private by default

Leave an answer