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.


Answer


An suer

C. The program has a compilation

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.