Lost again...

BlitzMax Forums/BlitzMax Programming/Lost again...

SLotman(Posted 2011) [#1]
When trying to compile the code below, I'm getting this error message:

Unable to convert from 'float Array' to 'float Array'



Type TGrid
	Field grid#[4,4]
End Type

Type class1
	Method m1(f#[]) Abstract
End Type

Type class2 Extends class1
	Method m1(f#[])
	End Method
End Type

Local c:class1 = New class2
Local g:TGrid = New TGrid

c.m1(g.grid)


Is this a bug, or am I doing something incredibly dumb...?

Last edited 2011


SLotman(Posted 2011) [#2]
Nevermind... just had to use Method m1(f#[,]) and it worked.


Kryzon(Posted 2011) [#3]
Method m1(f#[]) Abstract

Since we're getting at quick questions... is it necessary to declare a parameter with an abstract method?
What if the "extended" method ends up using two or more parameters?

-> Yeah you can't. You get an "Overriding method differs by type" error. The abstracted method and any method that overrides\overloads it can't return different data types, they can't have differing amounts and types of parameters (i.e: if one is Int, the other needs to be as well) etc.

Last edited 2011


SLotman(Posted 2011) [#4]
That's the price of not having 'overloading' in the language...


Czar Flavius(Posted 2011) [#5]
Overloading isn't relevent to this issue. It won't help you if your paramater type is incorrect.