A. With the advent of object-oriented programming, is it ever necessary to use C
ID: 3560241 • Letter: A
Question
A. With the advent of object-oriented programming, is it ever necessary to use C-type structs rather than classes? If so, when? What are the advantages or disadvantages of each approach? (5 points)
(Think about how the object-oriented concept of reusability relates to structs, structs within arrays, arrays within structs, and structs within structs. Think of some applications in which defining these data types for later use would be beneficial)
B. Discuss the relevant issues when determining whether to use public, protected or private members when defining new classes, especially base classes. (5 points)
Are there any risks involved with using the protected member access specifier instead of the private member access specifier?. 3 points)
Explanation / Answer
Structure is value type whereas class is reference type.A Structure is a value type. Its data is contained directly inside its bytes. Integers, Booleans and DateTimes are built-in Structures. The performance difference between a Structure and a Class comes from how the types are allocated. A Class reference points to data stored in a separate location
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.