knowledge is divine
Wednesday, January 5, 2011
my C++ rough work
// Testing friend function
#include
class sum
{
private:
int i;
friend void square(sum s);
sum()
{
i = 1;
}
public:
sum(int j)
{
i = j;
}
void get()
{
cout << i;
}
};
void square(sum s)
{
s.i = s.i*s.i;
cout << s.i;
}
int main(){
sum s(3);
square(s);
s.get();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment