Kód:
#include<stdio.h>
class TZlomok
{
public:
int C, M;
void Nastav(int nC, int nM);
void Vypis();
float Hodnota();
};
void TZlomok::Nastav(int nC, int nM)
{C=nC;M=nM;};
void TZlomok::Vypis()
{printf("%d/%d",C,M);};
float TZlomok::Hodnota()
{return(C/M);}
int main()
{TZlomok a;
a.Nastav(3,2);
a.Vypis();
printf("=%f",a.Hodnota);/*v tomto riadku...*/
getchar();}
...mi píše:"invalid use of member(did you forget the'&'?)"
a keď pred a.hodnota napíšem to '&' tak vypíše:"ISO C++ forbids taking the adress of a bound member...bla bla bla"
ale podľa mňa je to správne bez toho '&' neviete, kde mám chybu?