2
votes

I have this class defined but it doesn't work at all.

#ifndef LIBROS_H
#define LIBROS_H
#include "Articulo.h"
class Libros: public Articulo
{
public:
Libros();
~Libros();
string Autor;
string Editorial;
void mostrar();
void llenar();
};
# endif

this gives: error C4430: missing type specifier - int assumed. Note:C++ does not support default-int

3

3 Answers

5
votes

You forgot to #include the right header.

#include <string>

And since you have no using statement, you'll need to qualify your strings with the namespace they're in, which is std:

std::string Autor;
std::string Editorial;
1
votes

Two things:

#include <string>

and the string is in the std namespace. You'll need to use std::string rather than string.

0
votes

You have to include the string header and you must either prefix string with the namespace std or use a using namespace std;

#ifndef LIBROS_H
#define LIBROS_H

#include <string>
#include "Articulo.h"

class Libros: public Articulo
{
public:
    Libros();
    ~Libros();
    std::string Autor;
    std::string Editorial;
    void mostrar();
    void llenar();
};

# endif