Page 1 of 1

FreeBASIC

Posted: Sat Jun 18, 2005 12:10 am
by Exodus
I've read a lot about this...freebasic. I must say, this may be what I've been unconsciously looking (aka, the urge to program qbasic with the limitations and weak processing power).

I'm curious though. I see a lot of functionality has been added to the basic language with freebasic, but does it support TYPE SUBS and FUNCTIONS. More commonly know as Objects, in turn, Object Oriented Programming??

-Exodus

Posted: Sat Jun 18, 2005 12:15 am
by lurah-
Yes it does.

Type
Sub
Functions

Posted: Sat Jun 18, 2005 1:04 am
by Levi
Object Oriented Programming itself, not yet. Or so I was told.

Simply dealing with objects is not what Object Oriented Programming is about. A very common mistake.

Rather dealing with Classes, Virtual Functions, and PolyMorphism. That's what makes Object Oriented Programming, OOP. Otherwise even C could do OOP. Which, it can't.

Perhaps I wasn't clear enough

Posted: Sat Jun 18, 2005 1:16 am
by Exodus
I ment functions and sub that are specific to a custom TYPE variable...Object Oriented Programming

Example

Code: Select all

TYPE  Album
    name AS STRING
    caption AS STRING
    FUNCTION  set_data(n$, c$)
END TYPE

FUNCTION set_data(n$, c$)   '  "this" is used because the function
   this->name = n$          '   is specific to the variable declared
   this->caption = c$       '   as type Album.
END FUNCTION

so..

DIM MyAlbum AS Album

MyAlbum.set_data("my name", "my caption")
     or 
MyAlbum->set_data("my name", "my caption")
Do I make more sense?

Posted: Sat Jun 18, 2005 1:31 am
by Exodus
Thanks Levi. You answered my question as I was clearifying my question.
Levi wrote:Rather dealing with Classes, Virtual Functions, and PolyMorphism. That's what makes Object Oriented Programming, OOP.
This is what how I have come to understand as OOP. However I suppose my question delt with OOP "commonly misunderstood." Simply, manipulating a TYPE's variable with TYPE specific functions.

Perhaps this could come to be known as simple OOP or, BASIC OOP. I would very much love to see an implementation of such a concept in FreeBASIC....

I think I've spoken too much :?

-Exodus.

Re: Perhaps I wasn't clear enough

Posted: Sun Jun 19, 2005 1:49 am
by Guest
Exodus wrote:I ment functions and sub that are specific to a custom TYPE variable...Object Oriented Programming

Example

Code: Select all

TYPE  Album
    name AS STRING
    caption AS STRING
    FUNCTION  set_data(n$, c$)
END TYPE

FUNCTION set_data(n$, c$)   '  "this" is used because the function
   this->name = n$          '   is specific to the variable declared
   this->caption = c$       '   as type Album.
END FUNCTION

so..

DIM MyAlbum AS Album

MyAlbum.set_data("my name", "my caption")
     or 
MyAlbum->set_data("my name", "my caption")
Do I make more sense?
Can be emulated using Funk pointers.

Posted: Mon Jun 20, 2005 7:40 pm
by Nodtveidt
Arg, you nerd! :D It's func pointer, not funk pointer! :lol:

Posted: Tue Jun 21, 2005 1:18 am
by funky
Nekrophidius wrote:Arg, you nerd! :D It's func pointer, not funk pointer! :lol:
Shoo away!! "Funk" is Funkier.