I'm trying to add a struct inside a class inside inside a .h file and that what I came up with until now:
//Rectangle.h
#pragma once
#include <bits/stdc++.h>
using namespace std;
class Rectangle
{
public:
Rectangle() ;
struct recpoints
{
double x1, y1, x2, y2, x3, y3, x4, y4;
};
};
// Rectangle.cpp
#include "Rectangle.h"
Rectangle::Rectangle() {}
Rectangle::recpoints
{
recpoints() { x1 = y1 = x2 = y2 = x3 = y3 = x4 = y4 = 0.0; }
};
Now that code produces errors
g++ -c main.cpp Rectangle.cpp
Rectangle.cpp:5:5: error: expected unqualified-id before ‘{’ token
and I have no idea how should I fix it and how to use the struct in the Rectangle.cpp file?