|
|
Re: Structs acting like Classes
[Re: ultranet]
#124185
04/25/07 20:54
04/25/07 20:54
|
Joined: Oct 2006
Posts: 1,245
AlbertoT
Serious User
|
Serious User
Joined: Oct 2006
Posts: 1,245
|
Quote:
No, struct can't act as a class. Since a struct is just a collection of data and it does't has methods. It lacks many features of a class. C-Script/Lite-C is a procedural language, not an object-oriented language.
Well up to a certain extent , C-Script is also ,in my opinion, a basic OOP An entiy is an object having its own private variables Thanks to the pointer "my" you can assign a generic function to a specific object consequently this function is more or less a method You can not create abstracted classes which are not linked to an entity in the scene, that's true
|
|
|
Re: Structs acting like Classes
[Re: sheefo]
#124187
04/26/07 11:49
04/26/07 11:49
|
Joined: Oct 2006
Posts: 1,245
AlbertoT
Serious User
|
Serious User
Joined: Oct 2006
Posts: 1,245
|
Well maybe I did not explain myself Suppose you want to make a racing game you have 10 cars in the race
Using C++ you define a generic class Car This class contains generic variables : postion, speed etc As well as generic set of functions, for example : Move()
Then you istance 10 cars In the game play you call
car_00 .> Move() .......
car_09 .> Move()
In 3DGS you create 10 entities car Each car has its own set of variables You create one only set of functions , for example Move() using the my pointer and one only special function Action for example UpdateCar
You assign UpdateCar to the 10 cars
The program loop thtrough the 10 entities updating their position, speed etc
I have been using Blitz3d for some years, a great software However in Blitz you must declare 10 sets of variables and define 10 set of functions Move_00() ...Move_09() etc
From this point of view 3DGS is in my opinion a basic OOP
You can not create abstracted classes and you can not create a hyerarchy of classes
Lite_C should improve the OO capabilities
Last edited by AlbertoT; 04/26/07 11:55.
|
|
|
|