Professional Documents
Culture Documents
68 Oop12
68 Oop12
#include <iostream>
using namespace std;
class Vehicles
{
public:
int id;
int avg;
string brand_name;
string model;
// Default Constructor
Vehicles()
{
cout << "Default Constructor called !!" << endl;
}
// Parameterised Constructor
Vehicles(int _id, int _avg, string _brand_name, string _model)
{
cout << endl
<< "Parameterised Constructor called !!";
id = _id;
avg = _avg;
brand_name = _brand_name;
model = _model;
}
// Copy Constructor
Vehicles(Vehicles &V)
{
cout << endl
<< "Copy Constructor called !!";
id = V.id;
avg = V.avg;
brand_name = V.brand_name;
model = V.model;
}
// Overloaded Constructor
Vehicles(int _id, string _brand_name, string _model)
{
cout << endl
<< "Parameterised Overloaded Constructor called !!";
id = _id;
brand_name = _brand_name;
model = _model;
}
// Destructor
~Vehicles()
{
Experiment 2
return 0;
}
Output :