There is nothing wrong with your code except " class PizzaFactory: public Pizza{ ". You don't need to derive factory class from base class. Although this would not cause any fatal problems.
Post your main and the some more description of the problem.
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
So the problem is with main() and not those classes.. Again you shouldn't derive factory from the base.. it's against the pattern..
Change the main() to:
int main(){
PizzaFactory *p2 = new PizzaFactory;
Pizza* p = p2->getPizzaInstance(1);
cout<<p->getdesc()<<" $"<<p->cost()<<endl;
return 0;
}
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75