dynamic_cast with template class


Hello,

Below is a simplified definition of my interfaces/classes. I cannot modify the definition of A_Base. I am trying to use a dynamic_cast to change the A_Base* to the template class A<B>* (Line 22). This code worked when I last used it with Visual Studio.Net.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
interface A_Base {
	//	set() does not exist in this definition.
}

template <class T>
class A  public: A_Base {
private:
	T	_embeddedT;
public:
	void set(int i);

	void init(void) {
		_embedded.init(this);
}

interface B_Base {
	virtual void init(A_Base* a);
}

class b : public B_Base {
	void init(A_Base* a) {
		dynamic_cast<A<B>*>(a)->set(1);
	}
}


Any assistance is greatly appreciated.

Craig
Is this supposed to be C++? There is nothing called an "interface" in C++.
Last edited on
This code worked when I last used it with Visual Studio.Net
...
Any assistance is greatly appreciated.



I'm confused. If the code works, then what do you want assistance with?
Topic archived. No new replies allowed.