How do you define a class?

Coding Questions, IDE related or anything else

How do you define a class?

Postby Steve » Tue Sep 15, 2009 3:52 am

I have been reading through the guide and looking at the examples but I still do not see how we define a class -- it's instance variables -- and it's methods. I would appreciate any help or guidance you may give. I think this can be a great product -- Basic with complete Cocoa Framework access -- cool -- keep up the good work.

Steve
Steve
 
Posts: 2
Joined: Tue Sep 15, 2009 3:46 am

Re: How do you define a class?

Postby berndnoetscher » Tue Sep 15, 2009 8:00 am

To get a custom class, you only need to create a new file in the IDE. The filename determines the super class and the class name.

file base name = class name
file extension = super class name

example:

myForm.Window

file base name = myForm
file extension = Window

Only a few super classes are allowed now: Window, View, Object

To use it in the global.Object file:

Public Dim f As myForm

accessing somewhere

f.mysub()

A new update will come soon, with code completion ready and bug fixes.
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am

Re: How do you define a class?

Postby Steve » Tue Sep 15, 2009 9:17 pm

Thanks -- that will let me play with it a bit.

Steve
Steve
 
Posts: 2
Joined: Tue Sep 15, 2009 3:46 am

Re: How do you define a class?

Postby MaxClass » Sun Feb 21, 2010 7:15 pm

Bernd,

One of the first things I noticed within your example code regarding classes is that your examples leave off the "NS" in front of each of the Cocoa class names. I was not sure if this is by design or was accidentally omitted.

In the "QuickStart" example I had to add in the "NS" to class references in the code examples in order to make it compile.

However it was not necessary to use "NS" in front of "Object" in creating the "code" class. (code.Object)

This could be quite confusing to beginners with Objective-Basic such as I.

Your help on this subject would be greatly appreciated.

MaxClass
MaxClass
 
Posts: 3
Joined: Sun Feb 21, 2010 1:16 am

Re: How do you define a class?

Postby berndnoetscher » Mon Feb 22, 2010 9:27 am

MaxClass wrote:Bernd,

One of the first things I noticed within your example code regarding classes is that your examples leave off the "NS" in front of each of the Cocoa class names. I was not sure if this is by design or was accidentally omitted.

In the "QuickStart" example I had to add in the "NS" to class references in the code examples in order to make it compile.

However it was not necessary to use "NS" in front of "Object" in creating the "code" class. (code.Object)

This could be quite confusing to beginners with Objective-Basic such as I.

Your help on this subject would be greatly appreciated.

MaxClass


Well, you are right and it is a mistake as you read the language reference.
I will check it out today and upload a new version. Thanks for your comments :-)
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am


Return to Objective-Basic (Xcode 3)

Who is online

Users browsing this forum: No registered users and 0 guests

cron