Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

WHAT IS THE ONE SPECIFIC PROBLEM WITH THIS PROGRAM ? (there are no syntax errors

ID: 3812603 • Letter: W

Question

WHAT IS THE ONE SPECIFIC PROBLEM WITH THIS PROGRAM ? (there are no syntax errors) #include using namespace std; class A {public: string name, public: virtual void setname(string n) = 0; class B: virtual public A {public: void setname(string n) {name = n;)}; class C: virtual public A {public: void setname(string n) (name = n;}); class 0: public B, public C (public: void setname(string n) {B::setname(n);)); int main() {Al; B1; C1; D1; Al.setname("Anne'); Bl. setname(" Bob"); Cl.setname("Charlie"); D1.setname ("David"); system("pause") return 0;}

Explanation / Answer

The only problem with this code is that, it is not allowed to have an object A1. This is because, A1 is an object of type A, and A is a class with pure virtual function. And a class with pure virtual function is not allowed to have any instances for itself.