|
by: exits funnel |
last post by:
Hello,
I have the following simple code
//BEGIN CODE
#include <iostream>
class foo { public: virtual void fun( ) { }};
class bar : public foo {public:void fun( ) { }};
int main( )
|
by: Thomas Lorenz |
last post by:
Hello,
first, I didn't find any reference to my question through googling.
dynamic_cast uses RTTI to determine if the cast expression is valid.
Invalid casts of pointers give a '0'-result. As it is the case in the
following example:
-----------------------------------------------------------
#include <iostream>
|
by: Ganesh |
last post by:
On devx site, I saw following code. It says when a derived class is
tried to cast to base type, it looks at the missing vtable and
complains if the object is already deleted.
I am of the opinion that this doesnt work if the destructor is not
virtual or when the class has no virtual members. I would like to know
is there anything wrong in what...
|
by: tthunder |
last post by:
Hi @all,
Perhaps some of you know my problem, but I had to start a new thread.
The old one started to become very very confusing.
Here clean code (which compiles well with my BCB 6.0 compiler). You can
find a problem there, which cannot be solved by dynamic_cast, because
the pointers can be NULL, and I only want to know, if the pointer type...
|
by: Boris |
last post by:
I'm porting code from Windows to UNIX and ran into a problem with
dynamic_cast. Imagine a class hierarchy with three levels: class Level2
derives from Level1 which derives from Base. If you look now at this code:
Base *b = new Level2();
Level1 *l1 = dynamic_cast<Level1*>(b);
Should dynamic_cast return a valid pointer or 0? I wonder as...
|
|
by: yinglcs |
last post by:
Hi,
I have a c++ application which crashes in this line (from the debugger,
I have a segmentation fault here):
void *object = dynamic_cast<void>(aObject);
I have stepped thru the code in debugger and the 'aObject' pointer is
Not null. So can you please tell me, what else can go wrong so that my
program crashes in this line?
|
by: pietromas |
last post by:
In the example below, why does the dynamic_cast fail (return NULL)? It
should be able to cast between sibling classes ...
#include <iostream>
class A
{
public:
virtual const int get() const = 0;
|
by: baltasarq |
last post by:
Hi, there !
When I use dynamic_cast for a single object, I do something like:
void foo(Base *base)
{
if ( dynamic_cast<Derived *>( base ) != NULL ) {
((Derived *) base)->do_something()
}
}
|
by: lovecreatesbea... |
last post by:
Suppose I have the following three classes,
GrandBase <-- Base <-- Child <-- GrandChild
The following cast expression holds true only if pBase points object
of type of ``Child'' or ``GrandChild'', i.e. types not upper than
Child in the above class hierarchy,
dynamic_cast<Child*>pBase
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
|
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...
|
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...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
|