POV-Ray : Newsgroups : povray.off-topic : A question about Java generics (not a flame) : Re: A question about Java generics (not a flame) Server Time
7 Sep 2024 23:23:58 EDT (-0400)
  Re: A question about Java generics (not a flame)  
From: Darren New
Date: 14 May 2008 12:23:53
Message: <482b1219$1@news.povray.org>
Warp wrote:
>   Can you give me a concrete example?

I probably have all the syntax mixed up, and maybe you need to do 
something more complicated with friend functions and everything else, 
but this is my understanding of what they were talking about in the 
paper?  Basically, the environment in which X<T> is expanded is 
different, so the xyz.xx(4) would promote 4 to a long in main1 and not 
main2.


*** A.h

void X<T>(void);

class A {
   void xx(long i) {
     cout << "Alpha!\n";
   }
}


*** X.cpp

void X<T>(void) {
   T xyz;
   xyz.xx(4);
}

*** Main1.cpp

#include <A.h>

void main1(void) {
   X<A>();
}

*** Main2.cpp

#include <A.h>

void A::xx(int i) {
   cout << "Beta!\n";
}

void main2(void) {
   X<A>();
}



-- 
   Darren New / San Diego, CA, USA (PST)
     "That's pretty. Where's that?"
          "It's the Age of Channelwood."
     "We should go there on vacation some time."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.