473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

dynamic types,

Does it make sense to talk about dynamic/static types with pointers in an
inheritance chain without virtual functions. You can still upcast/downcast.
Also, is it safe to say the static type is the pointer type you specify at
compile time, and the dynamic type is the type actualy pointed to---they may
be the same in the case A* a = new A();
Oct 4 '06 #1
3 1490
* vsgdp:
Does it make sense to talk about dynamic/static types with pointers in an
inheritance chain without virtual functions.
Yes.

Also, is it safe to say the static type is the pointer type you specify at
compile time, and the dynamic type is the type actualy pointed to---they may
be the same in the case A* a = new A();
In general it's not safe to discuss terminology.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Oct 4 '06 #2

"Alf P. Steinbach" <al***@start.nowrote in message
news:4o************@individual.net...
>* vsgdp:
>Does it make sense to talk about dynamic/static types with pointers in an
inheritance chain without virtual functions.

Yes.

>Also, is it safe to say the static type is the pointer type you specify
at compile time, and the dynamic type is the type actualy pointed
to---they may be the same in the case A* a = new A();

In general it's not safe to discuss terminology.
What do you mean? Static and dynamic type are not well defined terms?

A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Oct 5 '06 #3
"vsgdp" <he***@null.comwrote in message
news:eYXUg.505$zf3.296@fed1read03...
Does it make sense to talk about dynamic/static types with pointers in an
inheritance chain without virtual functions. You can still
upcast/downcast.
Yes it does. Consider:

struct A { };
struct B : A { };

A* p = new B;
delete p; // undefined behavior

The statement "delete p;" has undefined behavior because the static type of
*p differs from its dynamic type and struct A doesn't have a virtual
destructor. If it didn't make sense for me to talk about static and dynamic
types in this context, how would I explain why "delete p;" has undefined
behavior?
Oct 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Charlie | last post by:
Hi, The description of Python always mentions "very high level dynamic data types". Now, I can't seem to find any examples of these (nothing described with this term anyway). Is this simply...
4
by: Leslaw Bieniasz | last post by:
Cracow, 20.10.2004 Hello, As far as I understand, the generic programming basically consists in using templates for achieving a static polymorphism of the various code fragments, and their...
3
by: JDPope | last post by:
I have a situation which I cannot get a good lead on how to resolve. One of the applications I support uses the Hibernate software to generate SQL. The app is JAVA with JDBC. In testing the users...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
0
by: rein.petersen | last post by:
Hi All, I've been working on a means to create dynamic asemblies (modules actually) from parsing XSD schemas which creates a perfect .net representation of the schema at hand (dynamically). ...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
2
by: Luis Arvayo | last post by:
Hi, In c#, I need to dynamically create types at runtime that will consist of the following: - inherits from a given interface - will have a constructor with an int argument
13
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and...
5
by: Guillermo Schwarz | last post by:
C++ers, I have programmed in C++ since 1991 and I probably created my best abstraction layers in C++ in those days. Since 2001 I've been programming in Java (at first against my will, then I...
5
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.