Can any one explain why the following program not giving the correct output.
#include <iostream>
using namespace std;
class a
{
int x;
public:
void set(int y)
{
x=y;
}
int get()
{
return x;
}
};
void f(a * b)
{
b = new a();
b->set(5);
}
int main()
{
a *a1;
f(a1);
cout<<"x = "<<a1->get();
return 0;
}
--
Regards
Saurabh
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.