What are the similarities between structs and classes? (Select all that apply)
Need help with C++ Work
![**Question: What are the similarities between structs and classes? (Select all that apply)**
- [ ] Private data members cannot be accessed outside of the class or struct
- [ ] A default constructor will always be provided in both structs and classes to allow objects to be constructed
- [ ] In both cases, objects are instances containing values
- [ ] Operator == can be used to compare either struct or class variables of the same type
- [ ] Operator = can assign variables of the same type by copying the values on the right to the object on the left
- [ ] Variables of type struct or class that are declared in a function can be a return value for the function.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F31ac961c-fe39-44eb-a9cc-55b50615d34f%2F5e94c172-e6df-40b2-b801-70e3e558e4c1%2Fuwfiqh6_processed.png&w=3840&q=75)

Similarities Between Structs And Classes are given below :-
1. Access specifies, such as public, private, and protected, are identically used in structures and classes to restrict the access of their data and methods outside their body.
2. The access level for class members and structs members, including nested classes and structs, is private by default. Private nested types are not accessible from outside the containing type.
3. Both can have constructors, methods, properties, fields, constants, enumerations, events, and event handlers.
4. Both structures and classes can implement interfaces to use multiple-inheritance in code.
5. Both structures and classes can have constructors with parameter.
6. Both structures and classes can have delegates and events.
Step by step
Solved in 2 steps









