Dot Operator Error

Hello,

I am trying to do a code with a header file, main, and client file. I keep getting recurring errors for a dot operator.

How would I fix this issue?

#include "fraction.h"
#include <iostream>
using namespace std;

// Constructors
fraction::fraction(){
numerator = 0;
denominator = 1;
}
fraction::fraction(int initNumerator, int initDenominator){
if(initDenominator == 0){
std::cout<<"Denominator can not be zero"<<std::endl;
exit(0);
}
numerator = initNumerator;
denominator = initDenominator;
}

The error states it cant be used.
What dot operator? I don't see any use of a dot operator.
Last edited on
Every line with the fraction::fraction I get the error " Cannot use dot operator on a type"
There is no use of the "dot operator" in the code that you've shown. The dot operator is a single period. Maybe you should show all of your code. Remember to put it in code tags:

[code]
your code goes here
[/code]
Every line with the fraction::fraction I get the error " Cannot use dot operator on a type"


I disagree. Here is your code, compiled fine:
https://ideone.com/VUEvdP
Topic archived. No new replies allowed.