#include #include using namespace std; string type = "Credit"; class credit card { public: }; credit

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

#include #include using namespace std; string type = "Credit"; class credit card { public: }; credit

Post by answerhappygod »

Include Iostream Include String Using Namespace Std String Type Credit Class Credit Card Public Credit 1
Include Iostream Include String Using Namespace Std String Type Credit Class Credit Card Public Credit 1 (106.74 KiB) Viewed 24 times
a. In which memory area is this element stored? Why?
b. The lifetime, begin & end, of this element? Why?
type
Which area: [1] [2] [3] [4a] [4b] [5]
Why is that area?
What is its lifetime and why?
cc2
Which area: [1] [2] [3] [4a] [4b] [5]
Why is that area?
What is its lifetime and why?
cc3, the object
Which area: [1] [2] [3] [4a] [4b] [5]
Why is that area?
What is its lifetime and why?
CC4, the object
Which area: [1] [2] [3] [4a] [4b] [5]
Why is that area?
What is its lifetime and why?
c. What is the output of the program?
#include <iostream> #include <string> 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; } private: } } void set_com (const string & com) { this->com_ = com; string credit card: :type_ = type; credit card& update_credit card (const double& balance) { balance }; static string type_; string com_{ "N/A" }; double balance_{0}; credit card ccl static credit card* cc2 = new credit card { 100 }; cc1.set_com ("Tesla"); *cc2cc1; 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;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply