Answer to Question #285209 in C++ for musty

Question #285209

define a class license that has a driving number ,name and address.define constructors that take on parameter that is just the number and another where all parameters are present.


1
Expert's answer
2022-01-07T01:49:44-0500
#include<iostream>
using namespace std;
class License {
public:
    int drivingNumber;
    string name;
    string address;
    
    License(string a) {
        name = a;
    }

    License(string b, int c) {
        address = b;
        drivingNumber = c;
    }

}

int main() {
    License obj1("Samuel") ;
    cout << "License name is: " << obj1.name << endl;

    License obj2("Texas USA", 0125) ;
    cout << "License address and driving number are: " << obj2.address << " and " << obj2.drivingNumber endl;
    return 0;
}


License name is: Samuel
License address and driving number are: Texas USA and 0125

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog