Cod:
var _class = function(){
var value : int;
}
var myClass : _class;
function Start()
{
myClass = new _class();
}
error: "cannot convert ‘void’ to ‘object’ ".
Cod:
var _class = function(){
var value : int;
}
var myClass : _class;
function Start()
{
myClass = new _class();
}
error: "cannot convert ‘void’ to ‘object’ ".
Try this:
function Apple (type) {
this.type = type;
this.color = "red";
this.getInfo = function() {
return this.color + ' ' + this.type + ' apple';
};
}
You can instantiate the Apple class like so:
var apple = new Apple('macintosh');
apple.color = "reddish";
alert(apple.getInfo());
Might be worth you doing some tutorials on Javascript - I’d recommend Codecademy.