#include <iostream>
struct A
{
explicit A( int pippo = 0 ) : pippo_value(pippo) {}
int pippo() const { return pippo_value ; }
private: int pippo_value ;
};
struct B
{
void set_pippo( const A& a ) // an object of type A is passed
{
v = a.pippo() ; // retrieve pippo from the passed object
std::cout << "v set to a.pippo(). value == " << v << '\n' ;
}
private: int v = 0 ;
};
int main()
{
const A a{234567} ;
B b ;
b.set_pippo(a) ; // pass the object as an argument
}