answersLogoWhite

0


Best Answer

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

User Avatar

Wiki User

โˆ™ 2012-09-15 06:24:07
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar
Study guides
4.25
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
4 Reviews

Add your answer:

Earn +20 pts
Q: What is dynamic constructor in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you write own constructor in c plus plus?

Yes.


True or False A C plus plus class constructor cannot return a function value?

True - A C++ constructor cannot return a value.


Parameterized constructor in c plus plus?

Usable, perfectly legal.


List out differennce between constructor and destructor in c plus plus?

Constructor creates an instance of class, destructor destroys it.


What is the difference between implicit and explicit call of constructor in c plus plus?

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.


Does the constructor is overloaded or not in c plus plus?

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.


Which key word is used as constructor in c plus plus?

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.


Types of constructor in c plus plus?

Default, Copy, Conversion, Implied (a case of default).


What is difference constructor and function in programming C plus plus?

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


Why does C plus plus allows static binding and not dynamic binding?

C++ allows both static and dynamic binding. Static binding occurs at compile time. Dynamic binding occurs at runtime.


What is a dynamic constructor?

dynamic constructor is a way to constructing an object based on the run type of some existing object. it basically uses standard virtual functions/polymorphism


Can you use more than one constructor in a class in c plus plus?

Yes, you can use, and often you should, use more than one constructor in a class in C++. Normally, there is a default constructor, a copy constructor, and one or more conversion constructors. Sometimes, there are also other constructors, overloaded based on argument signature, if there are complex situations.


Difference between dynamic binding and message passing in c plus plus?

what is the difference between message passing and dynamic binding


What is a sample of default constructor?

A default constructor is a constructor that takes no arguments.Here's a sample:class c{int a,b;c() //Constructor 1{a=2;b=1;}c(int x, int y) //Constructor 2{a=x;b=y;}};Here, Constructor 1 is called the default constructor, while Constructor 2 is a parameterized constructor.


Static vs dynamic binding in c plus plus?

Static binding occurs at compile time. Dynamic binding occurs at runtime.


What are merits and demerits of constructor in c plus plus?

Compared with what? There are no merits or demerits. Construction is the only way to initialise an instance of a class.


Can constructor be declared as constant in c plus plus?

No. Constructors initialise objects and, by definition, must be able to modify the member variables. Uninitialised members are a disaster waiting to happen even without a constructor declared const! Thankfully, the compiler won't permit a const constructor.


What is constructor overloading in c plus plus?

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).


Is overriding a dynamic polymorphism in c plus plus or not?

In C++, overriding and function, method, or operator is a different thing than (dynamic) polymorphism, so overriding a polymorphic method is almost entirely possible.


What is the difference between constructor and friend function in c plus plus?

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.


How dynamic constructor create in c plus plus?

By dynamic constructor I assume you mean the C++ new operator. It works by calling malloc to allocate a contiguous block of memory for the specified class, returning a pointer to that memory, or NULL if the allocation fails. The amount of memory allocated is the sum of all member variables, plus padding where required. If the class is a derived class, the contiguous block of memory will be large enough to accommodate all the base class member variables as well, and the least-derived class constructor is called first to initialise those variables, working down the hierarchy to the most-derived class constructor. When the pointer is deleted, the most-derived class destructor is called first, working back up the hierarchy (providing the least-derived class destructor is declared virtual).


Constructor and destructor invocation in c?

Not possible in C.


How do you invoke the constructor function in c plus plus?

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.


How can a constructor be invoked at the time of inheritance in C Plus Plus?

It cannot. Inheritance is a compile-time operation. Constructors are invoked at runtime at the point of instantiation.


What is Destructor in c plus plus?

In a class, the Destructor is like the opposite of the Constructor. The Constructor is run when an object of the class is created (usually to set up the variables as needed), and the Destructor is run when it is destroyed (usually to clean up or delete variables).