Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; string type = Credit; class credit _ card { public: credit _ card ( ) = default; explicit credit _

#include
#include
using namespace std;
string type = "Credit";
class credit_card {
public:
credit_card()= default;
explicit credit_card(const double& balance, string com = "Disney") :
com_(move(com)), balance_(balance){}
void display_info() const {
cout << credit_card::type_<<"["<< this->com_<<"]: "<< this->balance_<< endl;
}
void set_com(const string& com){
this->com_= com;
}
private:
static string type_;
string com_{"N/A"};
double balance_{0};
};
string credit_card::type_= type;
credit_card& update_credit_card(const double& balance){
credit_card cc1{ balance };
static credit_card* cc2= new credit_card{100};
cc1.set_com("Tesla");
*cc2= cc1;
return *cc2;
}
int main()
{
credit_card cc3= update_credit_card(300);
cc3.display_info();
credit_card cc4= credit_card{ cc3};
cc4.set_com("Zoom");
cc4.display_info();
credit_card* cc5= new credit_card{ update_credit_card(500)};
cc5->display_info();
cc3.set_com("Google");
cc4.display_info();
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions