在下面的代码中,我有一个具有int的动态数组的类A. 我有另一个类B有一个指向类AI的对象的指针数组已经写入类A的拷贝构造函数。我需要为B类写一个拷贝构造函数和析构函数,我尝试了各种方法,但没有成功。 A级 定义: class A {
public:
A::A(const A& other){
siz = other.siz;
c = other.c;
class A {
public:
A() {}
A(const A& a) { cout << "A::A(A&)" << endl; }
};
class B {
public:
explicit B(A aa) {}
};
int main() {
A a;
B b(a);
return 0;
}
为什么打印“
我有以下代码: #include <iostream>
using std::cin; using std::cout; using std::endl;
#include <vector>
using std::vector;
class Quote {
public:
Quote() = default;
Quote(const std::string &boo