error calling virtual class from array of base class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Parent{

    virtual void show(){};
};

class Child: public Parent{


     void show();
}

Parent** p=new Parent*[size];

for(some values){
    Child* c=new Child();
    p[index]=c;
    p[index]->show();//says no function match....
}
Last edited on
You haven't declared Child as being derived from Parent. You're also getting memory leaks. Use RAII or don't use new.
sorry, I did in main code...I updated again...
Topic archived. No new replies allowed.