Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Solve the following questions: Part A: Give th C++ keyword that is used to restr

ID: 3573360 • Letter: S

Question

Solve the following questions:

Part A:

Give th C++ keyword that is used to restrict access to data attributes and member functions.

Part B:

The following Unified Modeling Language diagram represents an object called Foo. Give the name of all private data members and private member functions for the object Foo.

Part C:

Explain in your own words what value is stored in variable temp below.

vector<double> X;

vector<double> : : iterator point;

double temp = 1.0;


// ... after X is initialized ...


if ( X.size() > 0 )

     for ( point = X.begin(); point != X.end(); point++)

           temp *= *point;

Part D:

Give the name of the C++ keyword that provides support for combining data attributes and member functions in one construction.

Give the C++ keyword that is used to restrict access to data attributes and member functions. O encapsulation. public O inheritance private

Explanation / Answer

1) Private keyword or function cannot be accessed, or even viewed from outside the class. Only the class and friend functions can access private members.

2) getR is the extractor or accessor member function that can be used to return the value of a data attribute within the class.

A naming convention must exist, and the name of the accessor must begin with the "Get" prefix.

3)setI is the mutator member function that can be used to modify the value of a data attribute within the class.

A naming convention must exist, with the name of the accessor beginning with the "Set" prefix

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote