#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;

class PriceFeed
{
public:
PriceFeed(vector<string>& tickers)
{
// init(tickers);
}
}
int main ()
{
vector<string> tickers;
tickers.push_back("AAPL");
tickers.push_back("XOM");

//PriceFeed(tickers);
PriceFeed pf = new PriceFeed(tickers); // Error on this line
system("pause");
//return 0;
}

Can you please tell me where am i going wrong. This is the error
conversion from `PriceFeed*' to non-scalar type `PriceFeed' requested

class PriceFeed
{
public:
   PriceFeed(vector<string>& tickers)
   {
// init(tickers);
   }
}; // missing semicolon
PriceFeed *pf = new PriceFeed(tickers); // Error on this line

You'll want a pointer.

thanks, it works if i put the pointer. My doubt is why do i have to put a pointer there. is there some way of creating a simple object without having to work with the pointer in this case.

That would have been

PriceFeed pf(tickers); // Error on this line

Oh thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.