Re: Templates
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 12/10/04
- Next message: Mike Gleason Jr Couturier: "Re: Templates"
- Previous message: David Webber: "Re: Fonts in static controls"
- In reply to: Mike Gleason Jr Couturier: "Templates"
- Next in thread: Mike Gleason Jr Couturier: "Re: Templates"
- Reply: Mike Gleason Jr Couturier: "Re: Templates"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 10 Dec 2004 11:14:14 -0500
Mike Gleason Jr Couturier wrote:
> Is it possible to do a thing like that and
> invoke test::Function by passing a class
> name (un-quoted) ?
>
> class test
> {
> public:
> test(){};
> virtual ~test(){};
>
> template<class T> void Function(){[...]};
> };
You can safely drop the three semicolons out of four in this program
and definitely the "[...]". You will still have valid C++ code.
However, it would be nice if you added the code where you'd show how
you intended to call test::Function (what is known as a "driver").
I submit that this:
class test
{
public:
test() {}
virtual ~test() {}
template<class T> void Function() {}
};
int main()
{
test t;
t.Function<double>();
}
is probably what you need. Is it? It compiles fine with VC++ v7.1...
Victor
- Next message: Mike Gleason Jr Couturier: "Re: Templates"
- Previous message: David Webber: "Re: Fonts in static controls"
- In reply to: Mike Gleason Jr Couturier: "Templates"
- Next in thread: Mike Gleason Jr Couturier: "Re: Templates"
- Reply: Mike Gleason Jr Couturier: "Re: Templates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|