- 4
What is the output of the C ++ program.
* What is the output of the C ++ program ?? * what's Attributes ?? * what's Methods ?? #include <iostream.h> class Machin { public : int bidule ; Machin(int b) { cout << " ++ Machin normal " << endl ; bidule = b ;} ~Machin() { cout << " -- Machin normal " << endl ; } } ; void main() { Machin m (1) ;}
1 Answer
0
Try writing your code neatly. Also, it will produce error as you are not using namespace std. Another thing is as far as I know, main function cannot return void.
For the question, just clean it a bit. And it will output:
++ Machin normal
-- Machin normal
Here is the clean code
#include <iostream>
using namespace std;
class Machin {
public :
int bidule;
Machin(int b) {
cout << " ++ Machin normal " << endl;
bidule = b ;
}
~Machin() {
cout << " -- Machin normal " << endl;
}
};
int main()
{
Machin m(1);
return 0;
}