Advertisement
jtentor

Libro.h

May 3rd, 2020
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. //
  2. // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
  3. //
  4.  
  5. #ifndef TP1CEC_LIBRO_H
  6. #define TP1CEC_LIBRO_H
  7. #include <iostream>
  8.  
  9. class Libro {
  10. private:
  11.     std::string titulo;
  12.     std::string autor;
  13.     std::string editorial;
  14.     int anio;
  15.     float precio;
  16.  
  17. public:
  18.     Libro(std::string const& titulo, std::string const& autor,
  19.             std::string const& editorial, int const& anio, float const& precio);
  20.  
  21.     // getters (por ahora en el header)
  22.     std::string const& getTitulo() const { return this->titulo; };
  23.     std::string const& getAutor() const { return this->autor; };
  24.     std::string const& getEditorial() const { return this->editorial; };
  25.     int const& getAnio() const { return this->anio; };
  26.     float const& getPrecio() const { return this->precio; };
  27.  
  28.     // setters (por ahora en el header)
  29.     std::string const& setTitulo(std::string const& titulo)  {
  30.         return this->titulo = titulo; };
  31.     std::string const& setAutor(std::string const& autor) {
  32.         return this->autor = autor; };
  33.     std::string const& setEditorial(std::string const& editorial) {
  34.         return this->editorial = editorial; };
  35.     int const& setAnio(int const& anio) {
  36.         return this->anio = anio; };
  37.     float const& setPrecio(float const& precio) {
  38.         return this->precio = precio; };
  39.  
  40.     // sobrecarga operador <<
  41.     friend std::ostream& operator<< (std::ostream& out, const Libro& libro);
  42.  
  43. };
  44.  
  45.  
  46. #endif //TP1CEC_LIBRO_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement