Explicit Constructor with program in C++ & “explicit” keyword in C++

In this blog post, you will learn about explicit constructor in C++ by using “explicit” keyword in C++.

Explicit constructor-:

1 argument parameterized constructor is made explicit by placing a keyword “explicit”, so that no automatic conversion of basic type to class type data takes place.

 

output-:

hr=…

min=…

sec=…

check the output and comment what values you got.

We have completed all the tutorials of operator overloading.

Leave a Comment

Your email address will not be published. Required fields are marked *

Do NOT follow this link or you will be banned from the site! Scroll to Top