Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / possible idea for OOP in DBC

Author
Message
Knartz
20
Years of Service
User Offline
Joined: 12th Apr 2005
Location:
Posted: 12th Apr 2005 09:54
hy @ all,
i have coded in some other languages but i always had probs with the grafics, so i tried dbc and i like it.

but i can't code in oop style. this disturbs me.
anybody who codes also in c++ or the like, who could give me some hints ??

thanks for your replys

P.S.: actually i coded for 6 hours and i am depleted now, so i could detail my problems tomorrow if you want. ~~~X-|

print " "
print " i like smileys !"
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 12th Apr 2005 18:05 Edited at: 12th Apr 2005 18:17
Knartz,

Object-Oriented Programming is made up of libraries and 'objects', which themselves are essentially made up of a group of functions and variables. An object is an interface linked to an array of data.

As the hand of Bruce Eckel in his open-source e-book, 'Thinking in C++, 2nd ed. Volume 1' wrote, "The interface establishes what requests you can make for a particular object. However, there must be code somewhere to satisfy that request. This, along with the hidden data, comprises the implementation. From a procedural programming standpoint, it’s not that complicated. A type has a function associated with each possible request, and when you make a particular request to an object, that function is called. This process is usually summarized by saying that you “send a message” (make a request) to an object, and the object figures out what to do with that message (it executes code)."

You can find this free e-book and many more by Bruce Eckel at his website, http://www.mindview.net/.

Create seperate .DBA files which inlcude function(s), and then make use of the #include command to implement these resuable functions into your current program. Design interfaces for your objects(buttons, panels etc), and use them, once clicked on or many other methods possible, to call these functions which execute specific code.

Have you ever practiced Microsoft Visual Basic? With it and some C++ knowledge, you should be able to get a firm grasp of how OOP is programmed. OOP is, at it's roots, proceduraly coded. DarkBasic is a procedural language.

In conclusion, you code the interface for the user to interact with buttons and more. When a button is triggered or something within the interface is triggered, then a boolean variable within that object's array should trigger a function call. Whatever you need to be accomplished, this called function, or functions, will do the job. This is simply how it is done.

+NanoBrain+
Neofish
21
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 12th Apr 2005 20:22
True OOP is impossible in DBP, and even harder in DBC unfortunetly. The reason is you don't have access to dynamic arrays within user-defined types (or user-defined types in DBC at all ). However you can make a very good attempt at it


Join the "C# is for programmers who are too stupid to use C++" club!
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Apr 2005 23:57
Quote: "impossible in DBP, and even harder in DBC"


lol, what you just said is, itself, impossible

What is harder than impossible? lol.

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 20th Apr 2005 14:28
The solution is....
DarkSDK!

I've been saving my pennies for a while, rather glad it came out before I was going to get DBP.

Crazy Donut Productions
Current Project: A Redneck game
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 23rd Apr 2005 07:42
As long as you understand DBC is *DEAD* (believe me, I was talking about DBC v1.14 in the forums in 2003, and the response was .. disheartening), then I'm fine with that.

Heh. Who knows. Maybe in the third incarnation of DarkBASIC.

You know, whatever they call it, the acronym oughta be DBX. 'Cuz it sounds cool. REAL cool.



How's my typing? Phone 0800-GO-TO-HELL

Login to post a reply

Server time is: 2025-05-23 10:51:28
Your offset time is: 2025-05-23 10:51:28