CS Homework 10

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The ____________ operator may be used to assign one object to another, or to initialize one object with another object's data. By default, each member of one object is copied to its counterpart in the other object.

=

A class copy constructor is called when:

A variable/object is being initialized from an object of the same class. A function is called with a value parameter of the class. A function is returning a value that is an object of the class.

What action is performed by a class' default copy constructor?

a member wise assignment

The class Stuff has both a copy constructor and an overloaded = operator. Assume that blob and clump are both instances of the Stuff class. For the statement below, indicate whether the copy constructor or the overloaded = operator will be called: Stuff splat = clump;

copy constructor

The class Stuff has both a copy constructor and an overloaded = operator. Assume that blob and clump are both instances of the Stuff class. For the statement below, indicate whether the copy constructor or the overloaded = operator will be called: showValues(blob); //blob is passed by value

copy constructor

A copy constructor is a special constructor that is called whenever a new object is created and initialized with the data of another object of a different class.

false

All C++ operators may be overloaded.

false

A(n) ___________________ is a function that is not a member of a class, but has access to the private members of the class.

friend

The class Stuff has both a copy constructor and an overloaded = operator. Assume that blob and clump are both instances of the Stuff class. For the statement below, indicate whether the copy constructor or the overloaded = operator will be called: blob.operator=(clump);

overloaded = operator

The class Stuff has both a copy constructor and an overloaded = operator. Assume that blob and clump are both instances of the Stuff class. For the statement below, indicate whether the copy constructor or the overloaded = operator will be called: clump = blob;

overloaded = operator

Every instance of a class maintains a hidden pointer to itself. The identifier of that pointer is:

this

A copy constructor must have a single parameter that is a reference to the same class. Forgetting the & that identifies reference parameters will result in compiler errors.

true

If the programmer does not specify a copy constructor for the class, then the compiler automatically calls a default copy constructor when necessary.

true

In addition to providing a means for the creation of objects, convert constructors provide a way for the compiler to convert a value of a given type to an object of the class.

true

Multiple assignment statements (e.g. a = b = c) work because the build-in assignment operator is implemented so that it returns the value of its left operand after the assignment has been performed.

true


संबंधित स्टडी सेट्स

World History A CP-Unit 4 Review

View Set

Physics 221 Exam 2 Review Questions

View Set

Article 300. General Requirements for Wiring Methods and Materials

View Set

Sadlier Unit 1 Synonyms / Antonyms

View Set

Prefixes that Pertain to Numbers and Amounts

View Set

Sociology: Ch. 20 Population, Urbanization, and the Environment

View Set

Chapter 32: The Child with Integumentary Dysfunction

View Set