answersLogoWhite

Top Answer
User Avatar
Wiki User
Answered 2011-12-21 21:28:19

A constructor creates the initial state of a collection of data. A function modifies or queries the data after it has been initialized.

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Related Questions


A constructor is a method that fires when the object is instantiated. A friend function is a function that has special access to the object. They are two different types of things, and cannot be further differenced.


An implicit constructor call will always call the default constructor, whereas explicit constructor calls allow to chose the best constructor and passing of arguments into the constructor.



Constructor overloading, just like any function's overloading, is where more than one configuration of parameters exists for the function. Based on the number and type of the parameters, different versions of the function can be resolved by the linker. This is typically used in the constructor as the default constructor (no parameters), the copy constructor (one reference parameter of the same type as the class), and the conversion constructor (any other combination of parameters).


a function is a code in braces to reduce the complexity of the program.


"C" is a structured programming language, function based, simple and compact. C++ is an object oriented programming language, but many people just use it as a "better C".


A constructor is a function defined in a class with the name same as the class name and is used to automatically initialized the class data members. It is never preceded by a return type not even void. eg - class abc { int a, b; abc() //constructor { a=0; b=0; } }; main() { abc a; } The time we create object of the class in the main function the data members of the class are automatically initialised. Constructor can even take parameter. Those constructor are known as parameterised constructor.


C is procedural based programming while C++ is extension of C and it follows object oriented technique


This constructor is used to allocate the memory to the objects at the run time..


That depends on how you define body of class. If you do not define constructors then compiler will provide default constructor and it is not overloaded. If you create your own constructor you automatically overload default constructor.


There is no specific keyword for a constructor in C++. Simply define and declare a method of the class with the same name as the class and it will be a constructor. A constructor with no arguments is the default constructor, a constructor with one argument of class type is the copy constructor, and a constructor with one argument of some other type is the conversion constructor. You can provide other overloaded constructors if you want.


Constructor creates an instance of class, destructor destroys it.


There is no such thing as a constructor function in C++ (constructors have no return value, not even void, and cannot be called like regular functions). Constructors are invoked rather than called directly, either by declaring a static variable of the class type, or via the C++ new operator.


Private construction prevents objects from the class from being instantiated other than via a static member function of the class, a friend function or a friend class.


The constructor is a method that runs to initialize the instance of the class. It runs right after memory allocation. The destructor is a method that runs to deinitialize the instance of the class. If runs right before memory deallocation.



The general order of initialization is:Base class objects (if present)Member data objectsConstructor function code


Java doesn't have pointers. C++ has pointers.


<iostream.h> is an old style of programming and does not allow using namespaces. If you use <iostream> you can use namespaces, and limit number of predefined function (not used) included with your program.


It is not a reserved word, so can be an identifier (name of a type/variable/function).



No. 1a and 3d are linear, but 2bc is not. ■


turbo c is a compiler and c++ is a programming language.


java is an advanced object oriented programming language than c++


The constructor is the first function that is called by default when you create an object of a class. The importance of constructor is as follows: 1. It lets you initialize the members of the class or default memory allocation for the class 2. It helps you to perform certain operations that you would like to be done when an object of the class is created. Also based on the types of constructor the need varies, like Default constructor is in built constructor that would define the member variable without any initialization value. A Parameter constructor allows the user to pass arguments to the constructor and hence perform certain operations as per user requirement. A copy constructor would allow you to copy an object of a class with another and hence avoiding the need of explicit copying the elements.



Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.