0

I am trying to get to work tried a couple different ways but i am still very new and don't know how to yet
index.cpp

#include "outline.h"
#include "TFP.h"
int main()
{	toonOutline playerToon;
	toonFillPrint::fill(playerToon);
        return 0;
}

outline.h

#include <string>
struct toonOutline
{ <toon info>
};

TFP.h

#pragma once
#include <iostream>

using namespace std;
class toonFillPrint
{
public:
	TFP(void);
	~TFP(void);
	void static fill(toonOutline&);
	void static print(toonOutline);
};

TFP.cpp

#pragma once
#include "toonFillPrint.h"
TFP::TFP(void)
{
}

TFP::~TFP(void)
{
}
void TFP::fill(toonOutline& toon)
{
	<fills in the toon info>	
}
void toonFillPrint::print(toonOutline toon)
{
        cout<< <toon info>
}

I get the error that says "syntax error : identifer 'toonOutline' in the TFP.h right for the function call fill. i have tried putting #include "outline.h" in the top of the header but i get " 'toonOutline' : 'struct' tyep redefinition" so i know that will not work. but i am not sure how to get it. I would thank you for any help.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Duoas
0

You've got the right idea, except that you can't name your constructor or destructor something different than the name of the class.

TFP.h
either

class ToonFillPrint
  {
  public:
    ToonFillPrint();   // constructor
    ~ToonFillPrint();  // destructor
  };

or

class TFP
  {
  public:
    TFP();   // constructor
    ~TFP();  // destructor
  };

TFP.cpp
to match what is above, either

ToonFillPrint::ToonFillPrint()
  {
  // construct me here
  }

or

TFP::TFP()
  {
  // construct me here
  }

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.