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.
#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
Comments
Leave a comment