Question: ```
#include <iostream>
using namespace std;
struct testarray{
    int element;
public:
    testarray(int a):element(a){}
};
class myarray 
{ 
public:
    testarray i; 

    public: 
            myarray(testarray a) : i(a){ } 

} ;
int main()
{
    myarray objArray[3] = {1,2,3};

    return 0;
}

```

The above code compiles fine in Visual C++ 2005 Express Edition IDE. But what I want is to prevent the compiler from implicitly typecasting the object type.

Answer: 
Use the keyword `explicit` for `testarray` constructor so that the compiler doesn't perform implicit conversions. Basically you need to write the constructor as:

```
explicit testarray(int a):element(a){}

```
Perhaps you want the constructor to be `explicit`?

[<http://www.cppreference.com/wiki/keywords/explicit>](http://www.cppreference.com/wiki/keywords/explicit)