Ariane Soft PPL2 Pocket Programming DataMite
  #1  
Old 02-17-2009, 07:09 PM
~J~ ~J~ is offline
Member
 
Join Date: Dec 2007
Location: Swansea, Wales
Posts: 47
Default Getting the hang of OOP

Can someone offer some advice on my little problem please?

Currently have an object that I'm trying to control via Procedures within it and failing at the first hurdle.

Have spent a good few hours on this and can't see anything glaringly obvious!

Have the following as my Class:

Code:
#class tst

	Private(xPos$,yPos$,zPos$,zVel$,sSize$);

	proc init
		// init variables here.
	end;

	proc Update
		//code to update.
	end;

#endclass

Now to me, this says that those variables within the Private declaration are private to each Class Object I create.

Now the code I'm running to both create and run the Init Procedure within that class is:

Code:
  #object tst a$
  a.init;
Again, unless I'm missing something obvious, I'd have thought that was correct.

But running this causes a:

Proc: WINMAIN(0,1)
Opcode: STACKOBJRUN

(WINMAIN(0,1))
Access Violation)

Error.

Any thoughts?
Reply With Quote
  #2  
Old 02-17-2009, 07:53 PM
Nicknack Nicknack is offline
Senior Member
 
Join Date: Nov 2006
Location: Germany
Posts: 527
Default

Code:
#class tst
	Private(xPos$,yPos$,zPos$,zVel$,sSize$);
	xPos$=10;


	public proc init
		Showmessage(xPos$);
	end;

	private proc Update
		//code to update.
	end;

#endclass


proc main
#object tst a$
  a.init;
  FreeObject(a$);
  
end;
here we go...
Reply With Quote
  #3  
Old 02-17-2009, 08:30 PM
~J~ ~J~ is offline
Member
 
Join Date: Dec 2007
Location: Swansea, Wales
Posts: 47
Default

Now that's really confused me!!

*EDIT*


Noticed the "Public" statement!!!!

Thanks Nicknack.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:29 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.
Copyright © 2009 www.ppl-lang.com - All rights reserved
Web Design by BR Web Consulting Ltd