Answered step by step
Verified Expert Solution
Question
1 Approved Answer
YES THE PROGRAM MUST BE DONE IN C++ ,YES THE PROGRAM MUST BE DONE IN C++ ,YES THE PROGRAM MUST BE DONE IN C++ MUST
YES THE PROGRAM MUST BE DONE IN C++ ,YES THE PROGRAM MUST BE DONE IN C++ ,YES THE PROGRAM MUST BE DONE IN C++
MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .MUST BE DONE IN C++ .
Structures and Classes Are Related Structures are part of the C subset and were inherited from the C language. As you have seen, a class is syntactically similar to a struct. But the relationship between a class and a struct is closer than you may at first think. In C++, the role of the structure was expanded, making it an alternative way to specify a class. In fact, the only difference between a class and a struct is that by default all members are public in a struct and private in a class. In all other respects, structures and classes are equivalent. This seeming redundancy is justified for several reasons. First, there is no fundamental reason not to increase the capabilities of a structure. In C, structures already provide a means of grouping data. Therefore, it is a small step to allow them to include member functions. Second, because structures and classes are related, it may be easier to port existing C programs to C++ Finally, although struct and class are virtually equivalent today, providing two different keywords allows the definition of a class to be free to evolve. In order for C++ to remain compatible with C, the definition of struct mus always be tied to its C definition . Although you can use a struct where you use a class, most programmers don't. Usually it is best to use a class when you want a class, and a struct when you wa a C-like structure. Sometimes the acronym POD is used to describe a C-style structure-one that does not contain member functions, constructors, or destructors. It stands for Pla Old Data. (Actually, the term POD is a bit more narrowly defined in the Standard C++ specification, but mear essentially the same thing.) In C++, a structure declaration defines a class type Unions and Classes Are RelatedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started