473,654 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic cast questions



What about dynamic_cast when dynamic reference is not unique (e.g. A-
>B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
Why would you use dynamic cast<void *>?

What is typeid & what does it return? How would you use it?

What is wrong here

void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
Sep 27 '08 #1
6 1661
puzzle cracker wrote:
>
What about dynamic_cast when dynamic reference is not unique (e.g. A-
>B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?

Why would you use dynamic cast<void *>?

What is typeid & what does it return? How would you use it?

What is wrong here

void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
Where have you actually seen any of these constructs? This smells like
homework.
Sep 27 '08 #2
On Sat, 27 Sep 2008 08:42:41 -0700, puzzlecracker wrote:
What about dynamic_cast when dynamic reference is not unique (e.g. A-
>>B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?

Why would you use dynamic cast<void *>?

What is typeid & what does it return? How would you use it?

What is wrong here

void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
Why don't you try google for it? Most of the time
that's a pretty fast way to get information and
answers.

--
OU
Remember 18th of June 2008, Democracy died that afternoon.
http://frapedia.se/wiki/Information_in_English
Sep 27 '08 #3
On Sep 27, 11:50 am, Jeff Schwab <j...@schwabcen ter.comwrote:
puzzle cracker wrote:
What about dynamic_cast when dynamic reference is not unique (e.g. A-
B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
Why would you use dynamic cast<void *>?
What is typeid & what does it return? How would you use it?
What is wrong here
void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);

Where have you actually seen any of these constructs? This smells like
homework.
lazy to google it, I found these guys at c++ trivia forum, I actually
have lots more of this intricate questions.

Not really in the need of solutions, just wanted you guys to see c++
from the unknown angle...
Sep 27 '08 #4
On Sat, 27 Sep 2008 09:46:04 -0700, puzzlecracker wrote:
On Sep 27, 11:50 am, Jeff Schwab <j...@schwabcen ter.comwrote:
>puzzle cracker wrote:
What about dynamic_cast when dynamic reference is not unique (e.g. A-
B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
Why would you use dynamic cast<void *>?
What is typeid & what does it return? How would you use it?
What is wrong here
void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);

Where have you actually seen any of these constructs? This smells like
homework.

lazy to google it, I found these guys at c++ trivia forum, I actually
have lots more of this intricate questions.

Not really in the need of solutions, just wanted you guys to see c++
from the unknown angle...
What unkown angle?

Are you trolling now?

--
OU
Remember 18th of June 2008, Democracy died that afternoon.
http://frapedia.se/wiki/Information_in_English
Sep 27 '08 #5
On Sep 27, 6:28 pm, Obnoxious User <O...@127.0.0.1 wrote:
On Sat, 27 Sep 2008 08:42:41 -0700, puzzlecracker wrote:
What about dynamic_cast when dynamic reference is not unique (e.g. A-
>B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
Why would you use dynamic cast<void *>?
What is typeid & what does it return? How would you use it?
What is wrong here
void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
Why don't you try google for it? Most of the time
that's a pretty fast way to get information and
answers.
So is asking questions here. With the advantage that 1) you
don't have to figure out how to enter your request (what
keywords should he google for here), and 2) there's actually a
reasonable chance that you get the right answer, and can
recognize it as such.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Sep 27 '08 #6
James Kanze wrote:
On Sep 27, 6:28 pm, Obnoxious User <O...@127.0.0.1 wrote:
[...]
>Why don't you try google for it? Most of the time
that's a pretty fast way to get information and
answers.

So is asking questions here. With the advantage that 1) you
don't have to figure out how to enter your request (what
keywords should he google for here), and 2) there's actually a
reasonable chance that you get the right answer, and can
recognize it as such.
3) You might learn much more than just the answer to what you asked.

4) So might we.

Schobi
Sep 27 '08 #7

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

Similar topics

5
8579
by: adrian | last post by:
hi all this is my first post to this group, so pls bear with me while i try to make some sense. i am trying to create a sproc which uses dynamic sql to target a particuar table eg. '.' and perform some actions. i am using @tableID as a passes parameter for the sproc.
4
8084
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure creates a string of custom SQL statement and returns this string back to the main stored procedure. This SQL statements work fine on there own. The SQL returned from the sub stored procedure are returned fine. The datatype of the variable that...
3
6818
by: MikeY | last post by:
Hi Everyone, I am working in C#, windows forms.My question is this. All my button dynamic controls properties are present and accounted for except for the"FlatStyle" properties. I can't seem to figure out, if there is a way of using polymorphic way (if that is a word) of doing this particular property. A sample of my code is as follows: DynamicControls.ButtonControl(this,btnSearchByName, new Point(5, 75), new Size(95, 20),...
2
2560
by: Zac | last post by:
Alright anyone who has 2c throw it in... I am working through a custom xml serializer and have come upon a conundrum, given our class design. The interface implemented on the base class (base for all business entities) dictates that the implementing class expose a Dirty property (for state). The base class (that actually manages state, once for all inheritors)
6
6393
by: Philipp Schumann | last post by:
Hi, I have a need for "dynamic type casting": in other words, in a "MyConvert" method I get passed an Object "value" and a Type "type" and the method should attempt to convert value into type. Of course it first tries to obtain the appropriate TypeConverter. However, for some types there are no applicable type converters. Consider a custom class "Dummy" from a linked assembly (in my scenario, neither the Dummy type nor its assembly...
7
3383
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 either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the database I am working on. IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL DROP TABLE REPORT_SELECTION
6
4086
by: DaTurk | last post by:
Hi, I have three interfaces lets call them parent, child-A, and child-B. I want to have one variable, that can be either child-A, or child-B at run time. I just can't seem to figure out how to do it. They both inherit from parent, and I tried holding a parent variable, and then casting it down to either of the children, but I can't see either of the childrens unique methods. Thanks in advance for the help.
1
8427
by: Pacific Fox | last post by:
Hi all, I have a SQL statement that allows paging and dynamic sorting of the columns, but what I can't figure out without making the SQL a dynamic string and executing it, or duplicating the SQL statement between an IF and ELSE statement. Following is the SQL statement; set ANSI_NULLS ON
13
1684
by: Jess | last post by:
Hello, I have some questions to do with dynamic binding. The example program is: #include<iostream> using namespace std; class A{
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.