find a bug in following code
Software QA/Tests Interview Questions from Microsoft
(Continued from previous question...)
find a bug in following code
Q:
Microsoft Interview Question for SDE in tests
find a bug in following code :
A:
class A
{
public:
static int i;
void print()
{
cout<< i << endl ;
}
};
int main()
{
A a;
a.print();
}
Only 1 bug:
1. static is a declaration not a definition, because you can not define static data inside a class so you have to define it outside the class, after class definition either in header file
(Continued on next question...)
Other Interview Questions
|