mardi 10 mars 2015

using auto/pointer to child, access child's parent method

I'm trying to figure out how to access a parent method using a pointer to the child class. Any ideas? I looked for examples but found things that were more different than not. child access parent - different.


I have a test class with the following:



auto canvasObj = parseCanvas(one, two);
Three l_three = CanvasObject::ParentOfCanvas->getThree(); //this isn't working
//I also tried l_three = canvasObj->getThree(); (doesn't work)


where:



class CanvasObject final : public ParentOfCanvas
{....}


and:



class ParentOfCanvas : public AnotherObject
{
public:
Three getThree();
...
}

Aucun commentaire:

Enregistrer un commentaire