Hi I have a delphi object to store some music information (note, start time, duratrion...) problem is I always get memory addressing error when I run the code,can someone please tell me where I'm going wrong!
I declare it in a seperate unit, with all my other declerations as follows:
type
SongClass = class
public
//Properties of SongClass
title : String; // Song title for user reference
tempo : integer; //tempo of the song
top : integer;
track : array[1..max_notes] of rNote; //musical data that is the song.
//Methods of SongClass
procedure addNote(inNote : rNote);
procedure sortSong;
constructor create;
end;
When it crashes it ends up with an acces violation.
It wont let me assign a value to any of the properties. I dont want it complicated, I know its kinda simple but it has to be!
I declare the variable just after the decleration of the class, its literally the next line of code:
var
song : songClass;
And when in the other forms I can see song as a variable with all the methods and properties I have made.
I have filled out the methods in rough but none of them do anything and it crashes before they can run anyway.
I do this to set up the object, even tho the constructor is empty:
procedure TForm1.FormCreate(Sender: TObject);
begin
song := song.create;
end;
If i put anything in the constructor, like top :=0; then it crashes there with the access violation!
Have i missed anything really simple out???
Thanks for any help anyone can give me! Its driving me mad!
JOsh :lol: