Fish.h
[CODE=cpp]
#ifndef FISH_H
#define FISH_H
#include <iostream>
#include <vector>
#include "Point.h"
class Fish : public Animal
{
public:
Fish();
Fish(const int fish_breed_time );
inline ~Fish() {decrement_num_ fish_current(); delete *this; };
Point *vector PossibleSurroun dings(all_surro undings); //based on edibility of cell's animal and surroundings
void JustEaten();
void ReduceGestation Time();
static int increment_num_f ish_current();
static int decrement_num_f ish_current();
private:
std::string taste; //options are bitter and sweet
int fish_breed_time ;
int fish_gestation_ time;
static int num_fish_curren t;
Point *vector all_surrounding s;
};
#endif
[/CODE]
Fish.cc
[CODE=cpp]
#include "Fish.h"
using namespace std;
Fish::Fish( fish_breed_time )
{
int fish_gestation_ time = fish_breed_time ;
increment_num_f ish_current();
}
Point *vector Fish::PossibleS urroundings(all _surroundings)
{
for (int i=0; i<all_surroundi ngs.length; i++)
{
CheckCell
}
}
void Fish::JustEaten ()
{
~Fish();
}
void Fish::ReduceGes tationTime()
{
fish_gestation_ time--;
}
static int Fish::increment _num_fish_curre nt()
{
num_fish_curren t++;
return num_fish_curren t;
}
static int Fish::decrement _num_fish_curre nt()
{
num_fish_curren t--;
return num_fish_curren t;
}
[/CODE]
errors -
1)Fish.h|10|err or: expected class-name before '{' token|
2)Fish.h|17|err or: expected `;' before "PossibleSurrou ndings"|
3)Fish.h|29|err or: expected `;' before "all_surroundin gs"|
4)Fish.h||In destructor `Fish::~Fish()' :|
5)Fish.h|16|err or: type `class Fish' argument given to `delete', expected pointer|
6)Fish.cc|6|err or: invalid function declaration|
7)Fish.cc|13|er ror: expected initializer before "Fish"|
8)Fish.cc||In member function `void Fish::JustEaten ()':|
9)Fish.cc|31|er ror: no match for 'operator~' in '~Fish()'|
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ios_base.h|104| note: candidates are: std::_Ios_Fmtfl ags std::operator~( std::_Ios_Fmtfl ags)|
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ios_base.h|144| note: std::_Ios_Openm ode std::operator~( std::_Ios_Openm ode)|
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ios_base.h|182| note: std::_Ios_Iosta te std::operator~( std::_Ios_Iosta te)|
10)Fish.cc|41|e rror: cannot declare member function `static int Fish::increment _num_fish_curre nt()' to have static linkage|
11)Fish.cc|48|e rror: cannot declare member function `static int Fish::decrement _num_fish_curre nt()' to have static linkage|
||=== Build finished: 9 errors, 0 warnings ===|
[CODE=cpp]
#ifndef FISH_H
#define FISH_H
#include <iostream>
#include <vector>
#include "Point.h"
class Fish : public Animal
{
public:
Fish();
Fish(const int fish_breed_time );
inline ~Fish() {decrement_num_ fish_current(); delete *this; };
Point *vector PossibleSurroun dings(all_surro undings); //based on edibility of cell's animal and surroundings
void JustEaten();
void ReduceGestation Time();
static int increment_num_f ish_current();
static int decrement_num_f ish_current();
private:
std::string taste; //options are bitter and sweet
int fish_breed_time ;
int fish_gestation_ time;
static int num_fish_curren t;
Point *vector all_surrounding s;
};
#endif
[/CODE]
Fish.cc
[CODE=cpp]
#include "Fish.h"
using namespace std;
Fish::Fish( fish_breed_time )
{
int fish_gestation_ time = fish_breed_time ;
increment_num_f ish_current();
}
Point *vector Fish::PossibleS urroundings(all _surroundings)
{
for (int i=0; i<all_surroundi ngs.length; i++)
{
CheckCell
}
}
void Fish::JustEaten ()
{
~Fish();
}
void Fish::ReduceGes tationTime()
{
fish_gestation_ time--;
}
static int Fish::increment _num_fish_curre nt()
{
num_fish_curren t++;
return num_fish_curren t;
}
static int Fish::decrement _num_fish_curre nt()
{
num_fish_curren t--;
return num_fish_curren t;
}
[/CODE]
errors -
1)Fish.h|10|err or: expected class-name before '{' token|
2)Fish.h|17|err or: expected `;' before "PossibleSurrou ndings"|
3)Fish.h|29|err or: expected `;' before "all_surroundin gs"|
4)Fish.h||In destructor `Fish::~Fish()' :|
5)Fish.h|16|err or: type `class Fish' argument given to `delete', expected pointer|
6)Fish.cc|6|err or: invalid function declaration|
7)Fish.cc|13|er ror: expected initializer before "Fish"|
8)Fish.cc||In member function `void Fish::JustEaten ()':|
9)Fish.cc|31|er ror: no match for 'operator~' in '~Fish()'|
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ios_base.h|104| note: candidates are: std::_Ios_Fmtfl ags std::operator~( std::_Ios_Fmtfl ags)|
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ios_base.h|144| note: std::_Ios_Openm ode std::operator~( std::_Ios_Openm ode)|
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ios_base.h|182| note: std::_Ios_Iosta te std::operator~( std::_Ios_Iosta te)|
10)Fish.cc|41|e rror: cannot declare member function `static int Fish::increment _num_fish_curre nt()' to have static linkage|
11)Fish.cc|48|e rror: cannot declare member function `static int Fish::decrement _num_fish_curre nt()' to have static linkage|
||=== Build finished: 9 errors, 0 warnings ===|
Comment