classes

This is the code i'm trying to define in scene.cpp but i'm stucked.
#include <iostream>
#include <iostream>
#include <iostream>
#include "scene.h"
using namespace std;

int main()
{
Triangle::Triangle();
Triangle:AddTriangle(Point mp1, Point p2, Point p3)
{
}
void Triangle:Draw()
{
}

Scene::Scene();
void Scene:AddTriangle(mp1, Point p2, Point p3)
{
}
void Scene:Draw()
{
}

return 0;
}
>>>>>>>>>>>>>>this is scene.h>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
class Point
{
public:
int mX, mY;
};

class Triangle
{
private:
Point mP1, mP2, mP3;
public:
Triangle();
Triangle(Point mP1, Point mP2, Point mP3);
void Draw();
};

class Scene
{
private:
Triangle mTriangles[10];
int mCount;
public:
Scene();
void AddTriangle(Triangle temp);
void Draw();
};

1.) What are the errors you are getting
and
2.) Why is iostream included 3 times...?
And

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int main()
{
Triangle::Triangle();
Triangle:AddTriangle(Point mp1, Point p2, Point p3)
{
}
void Triangle:Draw()
{
}

Scene::Scene();
void Scene:AddTriangle(mp1, Point p2, Point p3)
{
}
void Scene:Draw()
{
}

return 0;
}


is nonsensical. You are providing the implementation of the Triangle and Scene member functions within main(), which you cannot do.
Your scene.h and scene.cpp files should be added into your main program not be the main program.

Add the #ifndef, #define, #endif to your scene.h file also.

Add the [code] brace when placing code, it makes it easier to give feedback on
Topic archived. No new replies allowed.