Answer the question
In order to leave comments, you need to log in
Inheritance from a purely abstract class. Not included?
#pragma once
#include "Vector.h"
class AbstractFigure
{
public:
virtual void Scale() = 0;
virtual void Rotate() = 0;
virtual void Move(Vector direction) = 0;
};
#pragma once
#include "AbstractFigure.h"
class Point :
public AbstractFigure
{
public:
Point();
~Point();
// Inherited via AbstractFigure
virtual void Scale() override;
virtual void Rotate() override;
virtual void Move(Vector direction) override;
};
#pragma once
#include "AbstractFigure.h"
class Vector :
public AbstractFigure
{
public:
Vector();
~Vector();
// Inherited via AbstractFigure
virtual void Scale() override;
virtual void Rotate() override;
virtual void Move(Vector direction) override;
};
Answer the question
In order to leave comments, you need to log in
#pragma once
#include "Vector.h"
class AbstractFigure
...
#pragma once
#include "AbstractFigure.h"
class Vector :
public AbstractFigure
...
No, it won't. Because either AbstractFigure.h is the first one, or Vector.h, someone will be out of luck.
You can fix it like this:#pragma once class Vector; class AbstractFigure { public: virtual void Scale() = 0; virtual void Rotate() = 0; virtual void Move(const Vector& direction) = 0; };
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question