Конструктор:
Код: Выделить всё
VintagePort(const VintagePort& vp) {
};
Код: Выделить всё
#pragma once
#include
using std::string;
class Port {
private:
string brand;
string style;
int bottles;
public:
Port(string br = "None", string st = "None", int b = 0) {
brand = br;
style = st;
bottles = b;
};
Port(const Port& p) {
brand = p.brand;
style = p.style;
bottles = p.bottles;
};
virtual ~Port() {};
Port& operator= (const Port& p) {
brand = p.brand;
style = p.style;
bottles = p.bottles;
};
Port& operator +=(int b) {
bottles += b;
};
Port& operator -=(int b) {
if (bottles > 0)
bottles -= b;
else
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79355667/best-practice-for-passing-private-members-of-a-base-class-to-an-inherited-class[/url]