POO6
#include<iostream.h>
bool f(int a,int b){cout<<"f(a,b)"<<endl;return a>b;}
typedef bool FB(int,int);
typedef FB *PFB;
class f_bool
{
public:
f_bool(){cout<<"constructor de clasa"<<endl;}
f_bool(f_bool&){cout<<"constructor de copiere"<<endl;}
~f_bool(){cout<<"destructor "<<endl;}
PFB operator()(){cout<<"PFB operator()()"<<endl;return f;}
operator PFB(){cout<<"operator PFB()"<<endl;return f;}
};
bool compara(bool (*pf)(int,int),int a,int b){cout<<"Compara"<<endl;return(*pf)(a,b);}
void main()
{
int a=1,b=2;
f_bool mai_mare;
cout<<compara(&f,a,b)<<endl;
cout<<compara(mai_mare(),a,b)<<endl;
cout<<compara(mai_mare,a,b)<<endl;
Documentul este oferit gratuit,
trebuie doar să te autentifici in contul tău.