View Full Version : the class<foo> syntax

26th Aug 2001, 04:27 AM
is there a difference between these two variable declarations, or are they fundamentally the same thing?

local projectile p;
local class<projectile> Proj;

26th Aug 2001, 06:25 AM
Yep there is

local projectile p;
For projectiles only

local class<projectile> Proj;
For projectiles and all its children and its children's children etc. etc.

26th Aug 2001, 06:30 AM
lol there must be something wrong here I was logged in using my old account :)

26th Aug 2001, 08:29 AM
It`s actually a bit different:

projectile p
declares a variable p which you can assign any projectile and sublass of projectile.

class<projectile> proj
Is a class variable, this means you can't assign a object to it, you can assign a class however: proj= class'SomeChildOfProjectileOrProjectileClassItSelf'

The trick is that you can now ie. spawn a custom actor with that:
p= spawn( proj );

It is for example used to assign a specific class to an player who logs in. The definition within the < > brackets just tells the compiler which subclass of the class may later be assigned to the var. So you can't assign proj= class'enforcer' since enforcer is not sublass of projectile etc...

26th Aug 2001, 12:14 PM
ah... I get it. thanks!
it's the old peppercorn / peppermill thing :)