我有以下带有 2 个要阻止的指针的类
#ifndef SCORING_H
#define SCORING_H
#include "Block.h"
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
class Scoring
{
public:
Scoring(Block *, Block*, string, string, double);
virtual ~Scoring();
Scoring(const Block& b1, const Block &b2);
private:
Block * b1;
Block * b2;
string path1;
string path2;
double val;
};
#endif // SCORING_H
类块如下:
class Block {
public :
///constructo
Block(double, double, double, double, int, vector<LineElement*>);
///Setter functions
void setID(int);
void setTop(double);
void setLeft(double);
void setRight(double);
void setBottom(double);
void setLine(vector<LineElement*>);
int getID();
double getTop();
double getLeft();
double getBottom();
double getRight();
vector<LineElement*> getLine();
private:
int id;
vector<LineElement*> Listline;
double top;
double left;
double bottom;
double right;
};
#endif // ELEMENT_H_INCLUDED
我想知道,我是否应该为“Block * b1;Block * b2”构造一个复制构造函数,以及如何在 score.h 类中处理这两个点?
谢谢你。