C++ redefiniton of 'name' with a different type compiler warning
<p>Why do the compiler complain <code>redefiniton of 'reader' with a different type</code> when I try to pass an fstream object from main() into another class´s constructor for it to be read? I am aware of this is maybe i dumb way of doing it, I should really just have a string as parameter asking for filename then pass that into the fstream that I allocate in the constructor of the class. But anyways I am wondering why this don´t work, the compiler warning is cryptic.</p>

<p>my main function:</p>

<pre><code>fstream reader;
reader.open("read.txt");
Markov(reader);
</code></pre>

<p>Constructor in Markov.h class:</p>

<pre><code>class Markov {
public:
/** Constructor */
    Markov(fstream inStream) {
    Map&lt;string, Vector&lt;string&gt; &gt; array0;

    char ch;
    while (inStream.good())
    {
        ch = inStream.get();
        cout &lt;&lt; ch &lt;&lt; endl;
    }
    cout &lt;&lt; "End: " &lt;&lt; ch;

    order0(array0);
}
</code></pre>
