The explicit keyword prevents the constructor from being used to implicitly convert from a fundamental type to the class type.


== Noncompliant Code Example

----
class C
{
public:
  C ( int32_t a ) // Noncompliant
  {
  }
};
----


== Compliant Solution

----
class D
{
public:
  explicit D ( int32_t a )
  {
  }
};
----


== See

* MISRA {cpp}:2008, 12-1-3


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
