#include <iostream>
using namespace std;
class outer
{
public:
int x;
void get()
{
cin>>x;
}
class inner
{
private:
int y;
public:
void get()
{
cin>>y;
}
void sum()
{
outer k;
k.get();
cout<<k.x+y;
}
};
};
main()
{
outer::inner b;
b.get();
b.sum();
}
using namespace std;
class outer
{
public:
int x;
void get()
{
cin>>x;
}
class inner
{
private:
int y;
public:
void get()
{
cin>>y;
}
void sum()
{
outer k;
k.get();
cout<<k.x+y;
}
};
};
main()
{
outer::inner b;
b.get();
b.sum();
}
This code is slightly wrong, the rectified version is here:
ReplyDelete#include
using namespace std;
class outer
{
public:
int x;
void get()
{
cin>>x;
}
class inner
{
private:
int y;
public:
void get()
{
cin>>y;
}
void sum()
{
outer k;
k.get();
cout<<k.x+y;
}
;
};
};
int main()
{
outer::inner b;
b.get();
b.sum();
return 0;
}
This comment has been removed by the author.
ReplyDeleteNice blog thanks for sharing
ReplyDeleteAngular course
Angular training