Structures in c++ | Sololearn: Learn to code for FREE!


Structures in c++

Why i need structures? For what i can use it? How to use it?

5/3/2019 5:59:34 AM


2 Answers

New Answer


Սեդ Structures in C++ is a class where the default access is public unlike class where it is private. The default inheritence in structure is also public. Mainly exists in C++ for backward compatibility with C. You can use class whereever you want to use structure. struct A { int x; // public by default }; class A { int x; // private by default }; struct B : A // public inheritence by default { }; class B : A // private inheritence by default { }; I hope you know what classes are?