• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 2 páginas
Examen

Assignment 2_ Theory solutions.

Document preview thumbnail
Vista previa 1 fuera de 2 páginas

Assignment 2_ Theory solutions.

Vista previa del contenido

Assignment 2: Theory solutions
What is the purpose of the keywords public and private in the class declaration? - correct
answer-The public keyword is used to declare a member variable or function that may be
directly accessed from outside the class.
The private keyword is used to declare a member variable or function that cannot be directly
accessed from outside the class. These members can only be accessed/modified with the
use of an accessor/mutator function.

What is the difference between a class and an object? - correct answer-A class is a user
defined type that defines a collection of properties and methods which can be accessed by
creating an instance of that class.
An object is an instance of a class. It is usually a real-world entity.

What does it mean to 'instantiate' an object? - correct answer-Instantiating an object is when
we create an instance of an object. The object is given a name and created in memory.

What is the purpose of a constructor? - correct answer-A constructor is used to initialize an
object when it is created.

What is the difference between the default constructor and the overloaded constructor? -
correct answer-Both have the same name that matches the class name,
A default constructor is one that takes no parameters and is automatically generated if the
user doesn't define one. It is used to assign default values to the member variables.
An overloaded constructor takes one or more parameters that assign custom values to the
member variables.

What is the purpose of a destructor? - correct answer-A destructor is used to free up
resources used by an object, it deallocates the memory and performs other cleanup actions.

What is the purpose of an accessor? - correct answer-An accessor is used to access/read
private class data from outside the class.

What is the purpose of a mutator? - correct answer-A mutator is used to modify/set/change
private class data from outside the class.

What is the purpose of the scope resolution operator? - correct answer-A scope resolution
operator can be used to:
• Access a global variable when there is a local variable with the same name
• Define a class function from outside the class
• Access a class's static variables

What is the difference between the scope resolution operator and the dot operator? - correct
answer-A scope resolution operator is used with a class name. It is two consecutive colons.
It indicates the class name to which an object belongs

Información del documento

Subido en
30 de junio de 2024
Número de páginas
2
Escrito en
2023/2024
Tipo
Examen
Contiene
Preguntas y respuestas
$8.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
scholartutor
4.8
(923)
Vendido
2789
Seguidores
3
Artículos
10777
Última venta
3 semanas hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes