Hi,
I suppose this question was already often asked and in fact I am not
interested in a complete overview of the differences, cause I already
found them on several pages.
In fact, what I want to know is the following. What is meant by:
"Here's a subtle point, but it's a direct result of how types are
identified in .NET. Let's say that C++ code in assembly A has used a
List<int> template specialization and that C++ code in assembly B
expects to use that exact same specialized type. Code in assembly A
creates an instance of the List<int> type and passes a reference to that
instance to code in assembly B that wishes to use its List<int> type.
Boom! At the very least, you will get a runtime type mismatch exception.
Depending on how you pass the reference, you might even get the error at
compile time. The error is because the List<int> type in assembly A is
not the same type as List<int> in assembly B."
(Taken from:
http://www.developer.com/net/cplus/a...919_3367531_1).
What does the author means by assembly? Is this a class?
So far, I understand this, the following is not possible with templates:
class A
{
public std::vector<int> myVector;
public A(std::vector<int> _myVector)
{
// do something
}
}
class B
{
public std::vector<int> myVector;
public A _a;
public B() : myVector()
{
_a = new A(myVector);
}
}
(code is not compiled!)
Is this the problem described above, or what does the author means?
Thanks for your help!
Anton