Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
use pointers only when you have to
Source Link
Klaim

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


A*B l;
A& k = new B();l;

Here k pointsis a reference to an object of type A, but the real type of the pointedreferred object, its dynamic type, is B.

Here "dynamic" has the meaning of "known only at run-time".

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, its dynamic type, is B.

Here "dynamic" has the meaning of "known only at run-time".

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


B l;
A& k = l;

Here k is a reference to an object of type A, but the real type of the referred object, its dynamic type, is B.

Here "dynamic" has the meaning of "known only at run-time".

deleted 1 characters in body
Source Link
Robᵩ

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, its dynamic type, is B.

Here "dynamic" havehas the meaning of "known only at run-time".

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, its dynamic type, is B.

Here "dynamic" have the meaning of "known only at run-time".

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, its dynamic type, is B.

Here "dynamic" has the meaning of "known only at run-time".

another person who can't distinguish "its" from "it's"
Source Link
duffymo

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of it'sits real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, it'sits dynamic type, is B.

Here "dynamic" have the meaning of "known only at run-time".

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of it's real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, it's dynamic type, is B.

Here "dynamic" have the meaning of "known only at run-time".

What i think is that dynamic type means dynamically allocated object using new.

Nope.

The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.

That is, if we have :

class A {

};

class B : public A { };


A* k = new B();

Here k points to an object of type A, but the real type of the pointed object, its dynamic type, is B.

Here "dynamic" have the meaning of "known only at run-time".

Source Link
Klaim
Loading
lang-cpp