answersLogoWhite

0


Best Answer

The C++ standard has this to say about dynamic initialisation:

"Objects with static storage duration shall be zero-initialised before any other initialisation takes place. Zero-initialisation and initialisation with a constant expression are collectively called static initialisation; all other initialisation is dynamic initialisation."

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How is dynamic initialisation achieved in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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.


Is set rate 5.75 an example of an assignment statement in programming?

When you assign a value to a variable that already exists, then it is always considered an assignment, otherwise it is considered an initialisation. The main difference is that an initialisation must instantiate a resource to hold the value, whereas the resource already exists with an assignment. In some cases (especially with badly-designed objects), initialisation may in fact be a two-stage process where, behind the scenes, the resource is first instantiated in an uninitialised or default state before being assigned a value through an assignment operator. C, for instance, always uses a two-stage initialisation whereas C++ can use a one-stage initialisation which is more efficient.


In C plus plus What function is called to initialize a class?

Class initialisation is normally handled by the class constructor(s). Every constructor has an optional initialisation section between the declaration and the body of the constructor. This is generally used to call specific base class constructors, but can be used to initialise any member variables via their own constructors. Member variables may alternatively be initialised in the body of the constructor, but this is really only necessary when member pointers need to be allocated new memory. For those classes that have many members and many constructors, the initialisation may be handled by a private member method called by each constructor in order to simplify maintenance during development. However, when the class is finalised, the private member method will generally be replaced with formal initialisation sections in each constructor.


What are the difference between array declaration in java and c plus plus?

There is no difference, other than that declarations in C++ can also initialise the variable in a single instruction. C example: int x; // declaration x=5; // initialisation C++ example: int y=5; // declaration and initialisation combined.


What are separators in c plus plus?

Separators include commas, colons, semi-colons and white-space. Semi-colons are used to indicate the end of a code block or to separate one function from the next. Commas are used to separate function arguments, or to separate structure variables and class member initialisation lists (comma-separated lists). Colons are mainly used to signify class inheritance and the start of class initialisation segments. White-space separates a variable type from its name, but is also used to aid the readability of code.

Related questions

What do you mean by initialisation of objects in c plus plus?

Initialization of objects means to provide an initial value for the object. This is usually done by the constructor, or it can be done with an assignment statement.


Static vs dynamic binding in c plus plus?

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


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.


Does c and c plus plus support static or dynamic binding?

Yes and no. Static vs dynamic binding is not a C or C++ language issue; it is a linker issue. If you link with a .lib file that contains stubs for run-time loading, then the called routine will not be loaded until it is invoked, and it will not be made a part of the load module.


C plus plus uses dynamic memory management?

No, C++ does not use dynamic memory management. The programmer is entirely responsible for releasing dynamic memory when it is no longer required. When static objects fall from scope, their destructors are called automatically, but there is no automatic garbage collection for dynamic objects. Allocated memory remains allocated until the programmer manually releases it, or the thread that owns the memory is terminated.


What are the various concepts of c plus plus?

1.Classes and Objects 2.Constructors and Destructors 3.Inheritance 4.Polymorphism 5.Dynamic Binding


How dynamic binding acheived in c plus plus?

Dynamic binding is achieved via virtual functions and the virtual table that is associated with every class that declares or inherits a virtual function. The virtual table (or v-table) maps every virtual function (including pure-virtual functions) to a function pointer that points to the most-derived overload. This makes it possible to invoke specific behaviour even when the runtime type of the object is unknown to the caller.


Is set rate 5.75 an example of an assignment statement in programming?

When you assign a value to a variable that already exists, then it is always considered an assignment, otherwise it is considered an initialisation. The main difference is that an initialisation must instantiate a resource to hold the value, whereas the resource already exists with an assignment. In some cases (especially with badly-designed objects), initialisation may in fact be a two-stage process where, behind the scenes, the resource is first instantiated in an uninitialised or default state before being assigned a value through an assignment operator. C, for instance, always uses a two-stage initialisation whereas C++ can use a one-stage initialisation which is more efficient.


In C plus plus What function is called to initialize a class?

Class initialisation is normally handled by the class constructor(s). Every constructor has an optional initialisation section between the declaration and the body of the constructor. This is generally used to call specific base class constructors, but can be used to initialise any member variables via their own constructors. Member variables may alternatively be initialised in the body of the constructor, but this is really only necessary when member pointers need to be allocated new memory. For those classes that have many members and many constructors, the initialisation may be handled by a private member method called by each constructor in order to simplify maintenance during development. However, when the class is finalised, the private member method will generally be replaced with formal initialisation sections in each constructor.


What are the difference between array declaration in java and c plus plus?

There is no difference, other than that declarations in C++ can also initialise the variable in a single instruction. C example: int x; // declaration x=5; // initialisation C++ example: int y=5; // declaration and initialisation combined.


Is there any c plus plus programming in 3D animation?

Generally speaking, no. 3D animation is achieved with 3D animation software and scripts. The software may be largely implemented in C++, but that's not the same thing as creating 3D animations.


What are separators in c plus plus?

Separators include commas, colons, semi-colons and white-space. Semi-colons are used to indicate the end of a code block or to separate one function from the next. Commas are used to separate function arguments, or to separate structure variables and class member initialisation lists (comma-separated lists). Colons are mainly used to signify class inheritance and the start of class initialisation segments. White-space separates a variable type from its name, but is also used to aid the readability of code.