Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If I want changes to be persistent with basic data type variables (like ints or floats) why would I pass references to those variables rather

image text in transcribed

If I want changes to be persistent with basic data type variables (like ints or floats) why would I pass references to those variables rather than pass them by value? Discuss using an example. [4 marks] 1. 2. A function in C+ needs to be forward declared before we can use it, often in header files. What do we mean by this? [3 marks] How does a vector from the Standard Template Library compare with a standard one- dimensional array? What similarities are there? What differences? [4 marks] 3. . What do we mean by "dereferencing" a pointer? Provide an example of when we may use a pointer normally and dereferenced. [4 marks] What are we referring to when we talk about the stack and the heap? Provide an example of declaring an int on the heap, and also an example of declaring one on the stack. [4 marks] 5. What happens if we try to read or write past the end of an array with our C++ code? Is the behaviour consistent? Explain why or why not, describing how arrays are represented in memory. [4 marks] 6. 7. Why in C++ do we need destructors? Provide a practical example of why having a destructor coded would be important. [4 marks] 8. What does the C++ virtual keyword do? [3 marks]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions