types of constructors in c++

i want some clarity between different types of constructors in c++,
can anybody help me....
i want to see the code too...

Replies

  • vinci
    vinci
    1 default construtors
    2 copy constructors
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    3 super constructors
  • aarthivg
    aarthivg
    1.Parametrized constructors:

    constructors that can take arguments are termed as parametrized constructors. The number of arguments can be greater or equal to one.
    2.Default constructors:

    Default Constructor define the actions to be performed by the compiler when a class object is instantiated without actual parameters. Its sole purpose is to save the data members from the garbage value. It initialize the data members with the default values.
    3.Dynamic constructors:

    Allocation of memory to objects at the time of their construction is known as dynamic construction of objects and such constructors are called as dynamic constructors.
    4.Copy constructors:

    Copy Constructor define the actions performed by the compiler when copying class objects. A copy constructor has one formal parameter that is the type of the class.
    5.Conversion constructor:

    Conversion constructors provide a means for a compiler to implicitly create an object of a class from an object another type. This type of constructor is different from copy constructor because it creates an object from other class. but copy constructor is from the same class.

You are reading an archived discussion.

Related Posts

i just read in one of my books that before first browser called Mosaic was developed, there were already around 50 websites running. so how those websites were browsed without...
Jaguar and Warwick University are redefining automobile design using virtual reality with powerwalls. https://www.theengineer.co.uk/video/powerwalls-engineering-in-virtual-reality/1011546.article
https://cr4.globalspec.com/blogentry/18922/The-First-Rule-of-Sumo-Fight-Club-is
Hi People.. I am UK based student studying BSc Business Information Systems, and in my Final year. I am looking for a interesting project, any Idea's?? I like some of...
I am interested in solving coding problems like the ones on codechef, acm icpc. But I find I am approaching it the wrong way. All I know is basic c++...