davide
davide

Reputation: 231

Access violation exception in downcasting

When doing the following downcast, I am getting an access violation exception. I cannot understand why.

ExpressDataSet * data_set;
data_set = dynamic_cast<ExpressDataSet *>(reader.getExpressDataSet());

The method getExpressDataSet of reader is defined as follows:

virtual BaseExpressDataSet * getExpressDataSet();

The relationships between involved classes are as follows:

class BaseExpressDataSet
{
};

class ExpressDataSet : public BaseExpressDataSet
{
}

I think all the needed info are now provided. I hope you could help me clarifying this issue.

Upvotes: 1

Views: 1075

Answers (0)

Related Questions