errors in c++ class (iso c++ forbids declaration of with no type)

#ifndef SALLY_H
#define SALLY_H
#include <iostream>
#include "sally.h"

using namespace std;
class Sally
{
public:
sally(int initialAge);
sally(int initialWeight);
sally(int initialHeight);
~sally();
int GetAge(){return age;}
void SetAge (int age);
int GetWeight(){return weight;}
void SetWeight(int weight);
int GetHeight();
void SetHeight (int height){return height;}
void Hello();

private:
int _age;
int _weight;
int _height;

};

#endif // SALLY_H



Last edited on
Forgive me if I'm wrong since I'm a newbie.

Shouldn't the constructors and Deconstructors be in the same case as the name of the class?

Meaning: Sally, not sally.

It looks like the header file with name sally.h is trying to include itself

#ifndef SALLY_H
#define SALLY_H
#include <iostream>
#include "sally.h"


As it was already pointed out names of constructors and the destructor shall coinside with the class name. So the compiler considers this declaration

~sally();
as a function declaration without any declare type specifier.

Last edited on
Topic archived. No new replies allowed.