class test
{
int a;
public:
test(int b):a(b){}
void show(){
cout<<a;
}
};
void main()
{
test t1;
test t2(5);
t1.show();
t2.show();
}


}



class test { int a; public: test(int b):a(b){} void show(){ cout<<a; } }; void main()..

Answer / lakshmana swamy

test t2:

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C C++ Errors Interview Questions

Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .

3 Answers  


void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....

2 Answers  


Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.

1 Answers   Google,


difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?

2 Answers   TCS,


what is the large sustained error signal that eventually cause the controller output to drive to its limit

1 Answers   TCS,






How to develop a program using C language to convert 8-bit binary values to decimals. TQ

1 Answers   Amazon,


how tally is useful?

2 Answers  


printy(a=3,a=2)

3 Answers  


A sample program using data structure? what is file handling?

0 Answers   TCS,


when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;

2 Answers  


Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.

3 Answers  


wap for bubble sort

3 Answers  


Categories