[Tutorial] [Advanced]How to mimic Object-Oriented Programming in PAWN
#5

For those interested in function overloading, there is a tutorial https://sampforum.blast.hk/showthread.ph...pid3459023" target="_blank">here.

You can have syntax like C++ templates too, I have been working on STL plugin and managed to achieve syntax similar to the following by manipulations using defines:

Код:
list<Float> float_list; //equivalent to new new List:lst_float_list = STL_List_DT_Template_Float; 
//STL_List_DT_Template has a unique negative number which is of course invalid but it is used to identify the type when a method is used on the list for the first time

//Acts as a explicit constructor
list::float_list(); //has 3 overloads 

For local lists, one can have following syntax (Work in progress, having some issue with it)
list<String> strings(params); //For local variables, implicit constructor
//translates to new List:lst_strings = STL_List_DT_Template_String;
//list::strings(params) - basically calls the init function automatically

list::strings.push_back("String"); //This translates to _epl_list_push_back(lst_strings, "String");
Reply


Messages In This Thread
[Advanced]How to mimic Object-Oriented Programming in PAWN - by Sasino97 - 13.12.2015, 14:11
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by HydraHumza - 13.12.2015, 14:14
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by vassilis - 13.12.2015, 15:00
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Sasino97 - 13.12.2015, 16:21
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Yashas - 13.12.2015, 17:02
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by N0FeaR - 13.12.2015, 21:28
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Sasino97 - 26.01.2016, 20:55
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by KillerDVX - 27.01.2016, 11:27
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by SystemX - 30.01.2016, 17:11
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by NewbProgrammer - 31.01.2016, 05:59
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Sasino97 - 02.02.2016, 11:23
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Scranton - 18.08.2016, 12:29
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Eoussama - 07.11.2017, 18:31
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Xeon™ - 07.11.2017, 19:21
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by 0x88 - 04.12.2017, 10:39
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by SammyJ - 04.12.2017, 11:08
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by Kar - 07.12.2017, 04:29
Re: [Advanced]How to mimic Object-Oriented Programming in PAWN - by BiosMarcel - 07.12.2017, 14:31

Forum Jump:


Users browsing this thread: 1 Guest(s)