Question...

V

Vassilis Stratis

I have a very simple code which is consited of a simple class with a
constructor which takes an argument of type ifstream. Basically I
would like to provide a string in the main method which will
initialize a ifstream object and call the constructor... well I get
compiling errors...

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>

class Demo
{ public:

Demo(ifstream);
};

Demo::Demo(ifstream inputImg)
{ ifstream input = inputImg;
}

void main(char args[])
{ ifstream file = (args);
Demo d(file);
}

What's wrong with it??? I am just got started with C++ ;-)


Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top