• ¿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 3 fuera de 28 páginas
Examen

CSS 342: DS&A ; Second Exam

Document preview thumbnail
Vista previa 3 fuera de 28 páginas

+ New CS of the Week + Recursion + Binary, Hex, Octal (need examples) + Arrays and Pointers + Dynamic Memory / Pointers - Exam 1 Questions - Object Creations

Vista previa del contenido

CSS 342: DS&A ; Second Exam
bool operator==(const Object& other) const; - ANS Equivalency operator overload signature



bool operator!=(const Object& other) const; - ANS Not equivalent operator overload signature



bool operator<=(const Object& other) const; - ANS Less than or equal to operator overload signature



bool operator>=(const Object& other) const; - ANS Greater than or equal to operator overload signature



bool operator<(const Object& other) const; - ANS Less than operator overload header



bool operator>(const Object& other) const; - ANS Greater than operator overload signature



friend ostream& operator<<(ostream& stream, const Object& rhs); - ANS Out stream (output) operator
overload header



friend istream& operator>>(istream& stream, const Object& rhs); - ANS In stream (input) operator
overload header



using namespace std; - ANS "As", so it makes it so you don't have to use "std::" when doing
istream/ostream operations.



template<class T>

void Method(T parameter); - ANS How to templatize methods.



void Swap(int& a, int& b) {

int temp = a;

,a = b;

b = temp;

} - ANS Simple swap; int can be switched out for any data type.



int data_; - ANS How to format private data members.



#include <iostream> - ANS To import the iostream module, this allows input and output.



cout << "Hello World!"; - ANS Printing out the terminal, "Hello World!"



string data;

cin >> data; - ANS Taking in terminal input to string data variable.



#include <string> - ANS Importing the string module, allows for the use of the string data type.



int* number; - ANS Pointer to int number; if printed, will print out the memory address of int number.



#ifndef OBJECT_H_

#define OBJECT_H_

class Object {

...

};

#endif - ANS General structure of a object.h file, or a header file for Object.



Object::Object() {

, this->data_ = 0;

...

} - ANS General method implementation for a default constructor.



Object::Object(int data) {

this->data_ = data;

...

} - ANS General method implementation for a parameterized constructor.



int Object::data() const {

return data_;

} - ANS General method implementation for a data member getter.



#include "object.h" - ANS To import a header file; this is used for implementation files and the driver file.



enum Type {kA, kB, kC}; - ANS General structure for declaring enumerated types.



Enums - ANS They are values used for classification, under the hood, they are integer values that can be
compared. They are a data type that only has specific values.



enum Type {kA, kB, kC};

const string kTypes[3] = {"A", "B", "C"}; - ANS For enums, a good practice is to have strings or values for
them, so you can do kTypes[kA], to get "A".



Object Object::operator*(const Object& rhs) const {

...

Información del documento

Subido en
10 de diciembre de 2024
Número de páginas
28
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$16.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.
lectjoseph
3.5
(10)
Vendido
81
Seguidores
23
Artículos
5455
Última venta
2 meses 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