mardi 2 septembre 2014

How to detect whether a class is used as polymophsim?


Vote count:

0




Suppose in one old project(>1M lines), there is a class named Base which has two virtual functions foo,bar



Class Base
{
public:
virtual void foo();
virtual void bar();
};

Class Derived: public Base
{
public:
virtual void foo();
virtual void bar();
};


I doubt that Base is not used as polymophsim, so foo/bar should not be virtual.


To confirm my ideas, I need to find out whether there is a statement like:



Base *b = new Derived;


but if we pass the pointer among a function, it would be hard to find out, for example:



Base *foo()
{
...
Derived *d
...
return d;
}


Is there any way to do that?


Thanks.



asked 47 secs ago

camino

1,495






How to detect whether a class is used as polymophsim?

Aucun commentaire:

Enregistrer un commentaire