Menu

[Solved]Choose Two Answers Question Analyze Following Code Include Using Namespace Std Class Publi Q37289000

Choose two answers for this question.

Analyze the following code:

   #include <iostream>
   using namespace std;
   
   class A
   {
   public:
int s;
     A(int newS)
     { s = newS; }
   
     void print()
     { cout << s; }
   };
   
   int main()
   {
     A a;
     a.print();
   }

D. The program would compile and run if you change A a to Aa(5).

C. The program has a compilation error because class A does nothave a default constructor.

B. The program compiles and runs fine and prints nothing.

A. The program has a compilation error because class A is not apublic class.

Expert Answer


Answer to Choose two answers for this question. Analyze the following code: #include using namespace std; class A { public: int s;… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *