Re: [Flightgear-devel] C++ question - solved

2005-01-19 Thread Christian Mayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks for all the replies. They brought me on the right track. The solution I've got now is also known as the Barton and Nackman Trick. It's a bit pervert - but totaly legal C++ code: templatetypename leaftype class A { leaftype asLeaf() {

Re: [Flightgear-devel] C++ question - solved

2005-01-19 Thread Richard Harke
On Wednesday 19 January 2005 06:53, Christian Mayer wrote: Thanks for all the replies. They brought me on the right track. The solution I've got now is also known as the Barton and Nackman Trick. It's a bit pervert - but totaly legal C++ code: templatetypename leaftype class A {

Re: [Flightgear-devel] C++ question

2005-01-18 Thread Paul Kahler
It sounds to me like you should just drop the virtual function declaration in the abstract A class (or make it non-virtual). It serves no purpose other than trying to enforce your design on the subclasses. Since you require the foo() function to take a parameter of the subclass type, only a B can

[Flightgear-devel] C++ question

2005-01-15 Thread Christian Mayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, can someone help me to solve thise problem: Imagine I've got this class hierachy: class A { virtual bool foo( A bar ) = 0; } class B : A { bool foo( B bar ) { ... } } int main( void ) { B foobar; } this won't compile as

Re: [Flightgear-devel] C++ question

2005-01-15 Thread David Megginson
On Sat, 15 Jan 2005 15:12:57 +0100, Christian Mayer [EMAIL PROTECTED] wrote: But I only want class A to be an interface that tells everybody what to expect from it's derivated classes. And one of these things is, that every child must have a member that is called foo and has one parameter of

Re: [Flightgear-devel] C++ question

2005-01-15 Thread Manuel Massing
Hello Christian, If I understand your problem right, you could use class pointers (but you won't achieve strong typing at compile time), or templates. TEMPLATE EXAMPLE: template class T class A { virtual void foo(T param); }; CLASS POINTER EXAMPLE: class A { public: virtual void foo(A*

Re: [Flightgear-devel] C++ question

2005-01-15 Thread Andy Ross
Christian Mayer wrote: But I only want class A to be an interface that tells everybody what to expect from it's derivated classes. And one of these things is, that every child must have a member that is called foo and has one parameter of the type of the child itself. How do I achieve that?

Re: [Flightgear-devel] C++ question

2005-01-15 Thread Manuel Massing
template class T class A { virtual void foo(T param); }; Maybe I should add how to derive the class B from the template: class B : public AB { ... }; bye, Manuel ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org

[Flightgear-devel] C++ question...

2003-11-10 Thread Gene Buckle
I see code like this: limit_value (double * value, const SGPropertyNode * arg) .and wonder about the placement of the pointer operator. I would think the above would be functionally different than: limit_value (double *value, const SGPropertyNode *arg) I think of the multiplication operator

Re: [Flightgear-devel] C++ question...

2003-11-10 Thread Paul Surgeon
On Tuesday, 11 November 2003 00:47, Gene Buckle wrote: I see code like this: limit_value (double * value, const SGPropertyNode * arg) .and wonder about the placement of the pointer operator. C syntax : type *p C++ syntax : type* p The compiler doesn't care which you use. They both mean

Re: [Flightgear-devel] C++ question...

2003-11-10 Thread Gene Buckle
Thanks for the clue Paul. :) g. On Tue, 11 Nov 2003, Paul Surgeon wrote: On Tuesday, 11 November 2003 00:47, Gene Buckle wrote: I see code like this: limit_value (double * value, const SGPropertyNode * arg) .and wonder about the placement of the pointer operator. C syntax : type

Re: [Flightgear-devel] C++ question...

2003-11-10 Thread David Luff
On 11/10/03 at 2:47 PM Gene Buckle wrote: I see code like this: limit_value (double * value, const SGPropertyNode * arg) .and wonder about the placement of the pointer operator. I would think the above would be functionally different than: limit_value (double *value, const SGPropertyNode

Re: [Flightgear-devel] C++ question...

2003-11-10 Thread Gene Buckle
Personally I prefer int* ip; That would turn me into a gibbering idiot. :) Kernighan and Richie specifically say in The C Programming Language though that they like to write int *ip; since it reinforces the point that dereferencing ip (*ip) gives an int. Now THAT makes sense. You

Re: [Flightgear-devel] C++ Question/Problem, WRT New Sky Code

2002-09-19 Thread Jonathan Polley
Huzzah! I can run again! Thanks for the help, Jonathan Polley On Thursday, September 19, 2002, at 07:09 AM, Norman Vine wrote: Jonathan Polley I did see this code block in SkySceneLoader.cpp (I assume that it is global data): // Need to add a light here until we figure out how to use

[Flightgear-devel] C++ Question/Problem, WRT New Sky Code

2002-09-18 Thread Jonathan Polley
When I rebuilt the MacOS X version of FlightGear, after the 3D cloud code was added, I started getting an EXC_BAD_ACCESS runtime error. I did some looking around with gdb and found out that the error was happening BEFORE the main was being called. Program received signal EXC_BAD_ACCESS,

Re: [Flightgear-devel] C++ Question/Problem, WRT New Sky Code

2002-09-18 Thread Frederic Bouvier
From: Jonathan Polley [EMAIL PROTECTED] When I rebuilt the MacOS X version of FlightGear, after the 3D cloud code was added, I started getting an EXC_BAD_ACCESS runtime error. I did some looking around with gdb and found out that the error was happening BEFORE the main was being called.