Menu
support@authoritypapers.com
+1(805) 568 7317

c programing help consider the below code identify the potential problem s if any in 5187565

C++ Programing help: Consider the below code. Identify the potential problem(s) if any in two methods:

• DoWork1()

• DoWork2()

#include

#include

using namespace std;

class Automobile

{

private:

string Make;

int Year;

string Model;

public:

Automobile()

{

Make = “”;

Model = “”;

Year = 0;

cout

}

Automobile(string make, string model, int year) :

Make(make),

Model(model),

Year(year)

{

cout

}

Automobile(const Automobile & src)

{

Make = src.Make;

Model = src.Model;

Year = src.Year;

cout

}

public:

~Automobile()

{

cout

}

public:

const Automobile & operator=(const Automobile & src)

{

Make = src.Make;

Model = src.Model;

Year = src.Year;

cout

return *this;

}

public:

static Automobile * CreateAutomobiles(int count)

{

return new Automobile[count];

}

static Automobile * CreateAutomobiles()

{

Automobile autoMobiles[3];

return autoMobiles;

}

};

static void DoWork1()

{

Automobile * p1 = Automobile::CreateAutomobiles(3);

Automobile * p2 = Automobile::CreateAutomobiles();

}

static void DoWork2()

{

Automobile * pAutomobiles = Automobile::CreateAutomobiles(3);

delete pAutomobiles;

}

int main()

{

DoWork1();

DoWork2();

}

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now