473,387 Members | 1,501 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,387 software developers and data experts.

Creating a child under a parent type

Hello everyone. I'm quite new to this newsgroup and fairly new to C++,
though I have solid knowledge. Basically what I want to do is define a
child in a variable that has a parent type. I am using the Irrlicht
Graphics Engine and it has this function:

Idevice=createDevice(video::EDT_OPENGL,
core::dimension2d<s32>(512, 384), 16, false, false,
false,eventReceiver);

The "eventReceiver" variable has to be of type irr::IEventReceiver*.
Anyway, here is the variable declaration for "eventReceiver":

static Easy_Event_Receiver eventReceiver;

As you can see, there are type issues here, since they are of different
types. Though Easy_Event_Receiver is a child of irr::IEventReceiver* so
isn't it suppose to inherit the type or something. Anyway, I've tried
various things from logical to utterly stupid. I've tried typecasting
though that doesn't work. There must be some way that I can define the
eventReceiver variable with type irr::IEventReceiver* while it still
holds the Easy_Event_Receiver class. Any help would be greatly
appriciated.

ADT_CLONE

Oct 14 '06 #1
2 1444
ADT_CLONE wrote:
Hello everyone. I'm quite new to this newsgroup and fairly new to C++,
though I have solid knowledge. Basically what I want to do is define a
child in a variable that has a parent type. I am using the Irrlicht
Graphics Engine and it has this function:
That library is (like all 3rd party tools) off-topic in this group. Please
read the FAQ for what goes here and where to take questions that don't go
here. You will be rewarded by better answers.
Idevice=createDevice(video::EDT_OPENGL,
core::dimension2d<s32>(512, 384), 16, false, false,
false,eventReceiver);

The "eventReceiver" variable has to be of type irr::IEventReceiver*.
Anyway, here is the variable declaration for "eventReceiver":

static Easy_Event_Receiver eventReceiver;

As you can see, there are type issues here, since they are of different
types. Though Easy_Event_Receiver is a child of irr::IEventReceiver* so
isn't it suppose to inherit the type or something.
One cannot inherit from irr::IEventReceiver* since it is not a class-type.
It's a pointer-to-class type, which is different. Let's assume you meant
that Easy_Event_Receiver inherits from irr:IEventReceiver.
Anyway, I've tried
various things from logical to utterly stupid. I've tried typecasting
though that doesn't work. There must be some way that I can define the
eventReceiver variable with type irr::IEventReceiver* while it still
holds the Easy_Event_Receiver class. Any help would be greatly
appriciated.
Did you try to pass the address of eventReceiver (which would be of type
Easy_Event_Receiver* and should be compatible with irr::IEventReceiver* if
Easy_Event_Receiver inherits from irr:IEventReceiver):

Idevice=createDevice
(video::EDT_OPENGL,
core::dimension2d<s32>(512, 384), 16, false,false,false,
&eventReceiver);
^^^

Note the "&".
Best

Kai-Uwe Bux

Oct 14 '06 #2

Kai-Uwe Bux wrote:
ADT_CLONE wrote:
Hello everyone. I'm quite new to this newsgroup and fairly new to C++,
though I have solid knowledge. Basically what I want to do is define a
child in a variable that has a parent type. I am using the Irrlicht
Graphics Engine and it has this function:

That library is (like all 3rd party tools) off-topic in this group. Please
read the FAQ for what goes here and where to take questions that don't go
here. You will be rewarded by better answers.
Yeah, I was just giving a full explanation. It wasn't really the
graphics engine I was having problems with.
Idevice=createDevice(video::EDT_OPENGL,
core::dimension2d<s32>(512, 384), 16, false, false,
false,eventReceiver);

The "eventReceiver" variable has to be of type irr::IEventReceiver*.
Anyway, here is the variable declaration for "eventReceiver":

static Easy_Event_Receiver eventReceiver;

As you can see, there are type issues here, since they are of different
types. Though Easy_Event_Receiver is a child of irr::IEventReceiver* so
isn't it suppose to inherit the type or something.

One cannot inherit from irr::IEventReceiver* since it is not a class-type.
It's a pointer-to-class type, which is different. Let's assume you meant
that Easy_Event_Receiver inherits from irr:IEventReceiver.
Anyway, I've tried
various things from logical to utterly stupid. I've tried typecasting
though that doesn't work. There must be some way that I can define the
eventReceiver variable with type irr::IEventReceiver* while it still
holds the Easy_Event_Receiver class. Any help would be greatly
appriciated.

Did you try to pass the address of eventReceiver (which would be of type
Easy_Event_Receiver* and should be compatible with irr::IEventReceiver* if
Easy_Event_Receiver inherits from irr:IEventReceiver):

Idevice=createDevice
(video::EDT_OPENGL,
core::dimension2d<s32>(512, 384), 16, false,false,false,
&eventReceiver);
^^^

Note the "&".
Yeah, I did try that and it didn't work. Though the problem has been
fixed. I just set the variable of type IEventReceiver* and then, under
the contructer, put this:

eventReceiver = new Easy_Event_Receiver();

And it worked fine. Thanks for all the help.

ADT_CLONE

Oct 14 '06 #3

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

Similar topics

7
by: David Sobey | last post by:
hi Here's some code: void SomeFunc(childClass arg); .... parentClass a; a=new childClass(); SomeFunc(a);
5
by: Mike Turco | last post by:
What is the difference between creating relationships in the front-end vs. the back-end database? I was trying to create a relationship in a database front-end and noticed that I could not check...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
4
by: LCAdeveloper | last post by:
Help! Another newbie question I'm afraid. I have a toolbar on an MDI form, which I can control OK to produce a child form. When the child form is active, the appropriate MDI parent form toolbar...
10
by: Goran Djuranovic | last post by:
Hi all, Does anyone know how to declare a variable in a class to be accessible ONLY from a classes instantiated within that class? For example: ************* CODE ***************** Public...
0
by: Innova | last post by:
Hi, We are working on a gridview inside the gridview (parent-child) scenario. The data of child grid will depend on the data of parent. Objectives: 1.Add new row in parent grid after each row...
4
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a...
3
by: zacks | last post by:
Forgive me if this has been already asked an answered, I did do a search both here and in VS2005 Help, but I can't find the answer to my question. I am developing an MDI application that is a...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.