How do i dereference a pointer to something in a class without having to write another function to dereference it for me? For instance in this code:
class Fraction
{
public:
Fraction(int left = 0, int right = 1);
Fraction(Fraction & obj);
~Fraction() { delete fl; }
double getFraction() { return *fl; }
void operator=(Fraction & obj);
friend ostream &operator<<(ostream & out, Fraction & obj);
private:
int n; // numerator
int d; // denominator
double * fl; // pointer to double value which is the decimal equivalence
// of the fraction
};
ostream &operator<<(ostream & out, Fraction & obj)
{
out << obj.getFraction(); // don't want to use function here
return out;
}