Class A
{
public x;
class B
{
public:
int Y
B search(int tempx,int tempy)//not constuctor its memberfunction
};
B ObjB[25];TempB
};
B A::B::search(int PId,int SId)
{
A obj
int i;
fstrean AFile("A.dat",ios::in | ios::binary);
while(A.read((char *)&TempProduct,sizeof(Product)))
{
if(A.x==tempx)
{
for(i=0;i<25;i++)
{
i want the value of class B as return type but i got error as following
1)syntax error : missing ';' before 'tag::id'
2)'B' : missing storage-class or type specifiers
3)unexpected end of file found
my main problem is how to return class b data with main function
struct A
{
// ,,,
struct B
{
int a ;
int b ;
// ...
B foo( int x, int y ) const ;
};
// ,,,
B its_b_object { 10, 20 };
};
A::B A::B::foo( int x, int y ) const { return B { a+x+y, b-x-y } ; }
int main()
{
A some_a ;
A::B object = some_a.its_b_object.foo( 1, 2 ) ;
// use object
}