Thread: Gs3
View Single Post
  #96  
Old 06-18-2013, 10:12 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Gunderak View Post
The class should extend something , try extends TStaticVar.
It will probably make it singleton but eh as long as you only use it once.
But also GS1-3 not being a proper language, it doesn't act like proper languages.
Oddly playing around, if you create the object, the class can extend it o.0 not the actual class though?
PHP Code:
//#GS3
class Foot extends TStaticVar{
  var 
id:int;
}
class 
Toe extends Foot{
  var 
id:int;
}
function 
onCreated():void{
  var 
Foot:Foot = new Foot();
  var 
toe Toe = new Toe();
  
toe.id 1;
  echo(
toe.id);

And yet,

PHP Code:
class Animal { ... }
class 
Cat extends Animal { ... }
class 
Dog extends Animal { ... }
var 
cat Cat = new Cat();
var 
dog Dog = new Dog();
var 
cat_as_animal Animal =  cat as Animal// OK as the Cat type is a member of the Animal type.
var cat_as_cat Cat cat_as_animal as Cat// OK as the Cat type is a member of the Animal type.
var cat_as_dog Dog cat as Dog// KO as the Cat type is not a member of the Dog type.
var cat_as_animal_as_dog Dog cat_as_animal as Dog// null as the Cat as Animal type is not a member of the Dog type. 

Taken from: http://wiki.graal.net/index.php/Crea...t3#as_operator

It did resolve my query regarding referencing the base class..need to use 'as' operator
Reply With Quote