Skip to Content
0
Former Member
Dec 21, 2007 at 10:42 AM

Friend class

36 Views

Hi to all,

I have created two classes 1) ztest and 2) ztest_cl.

I have declared 3 private variables of data type i say n1, n2, n3 .i gave Visibility as private for all three variables. And also in the ztest class i have declared ztest_cl as a friend class in friend attribute.

Now i want to use those data variables in one of the method in the ztest_cl.

I am writing code some thing like this n3 = n1 + 2 without declaring these parameters in ztest_cl class.

But its showing a error that data types (n1 and n2 and n3) unknown.

As it is friend class it should accept those variables but its not taking those variables.

Can any one suggest me please?

Thanks & Regards

Priya