| 
		
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: [CHALLENGE THREAD] 
 
				 (04-15-2012, 12:24 AM)Homicide13 Wrote:  So classes are normally defined within .h (header) files, the file that defines the class methods is the .lib (library) file (maybe?), and the file that actually makes use of the class members is the main.cpp source file (or I guess any of the source files? o.o)? 
In C++, classes are declared  in header files (e.g. *.h) and defined  in *.cpp files (though they can also be declared in the .cpp file). Library files (e.g. *.dll) aren't always created by the compiler, but when they are they do hold information (not necessarily classes) required by the program. 
			 
 
				
(This post was last modified: 04-15-2012, 12:51 AM by Your Computer.)
 |  |  
	| 04-15-2012, 12:50 AM |  |  
	
		| Homicide13   Senior Member
 
 Posts: 323
 Threads: 41
 Joined: Nov 2010
 Reputation: 
14
 | 
			| RE: [CHALLENGE THREAD] 
 
				 ![[Image: 18587437.jpg]](http://cdn.memegenerator.net/instances/400x/18587437.jpg)  
Sorry, I had to...
			 
 |  |  
	| 04-15-2012, 01:21 AM |  |  
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: [CHALLENGE THREAD] 
 
				 (04-15-2012, 01:21 AM)Homicide13 Wrote:  Sorry, I had to... ![[Image: FacePalm.gif]](http://www.manipurtalks.com/smilies/FacePalm.gif)  
 |  |  
	| 04-15-2012, 01:32 AM |  |  
	
		| nemesis567   Posting Freak
 
 Posts: 874
 Threads: 65
 Joined: May 2011
 Reputation: 
10
 | 
			| RE: [CHALLENGE THREAD] 
 
				You seem to be know a lot on the matter. Maybe you can help me with something.
 
 Suppose there is a class myClass and inside there is a memberFunction() which has the same name but is different in both functions.
 
 If I Aim a Base-Class Pointer at a Derived-Class Object and then use the pointer to call the function, supposedly the function called is the one from the derived class. But what happens if I aim a Derived-Class pointer to a Base-Class Object? Should it call the derived class function or won't it work? What if the member function of the derived class, calls another member function that only exists in the Base-Class?
 
 I've been struggling a bit with this for some time. I hope you can help.
 
 
  Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
 |  |  
	| 04-15-2012, 01:53 AM |  |  
	
		| Homicide13   Senior Member
 
 Posts: 323
 Threads: 41
 Joined: Nov 2010
 Reputation: 
14
 | 
			| RE: [CHALLENGE THREAD] 
 
				Is there any way to convert strings to integers in Angelscript? I know you can (well according to the website) explicitly convert things such as integers to floats by typing for example float(2).
 I have strings of single digit integers that I want the compiler to read as integers instead of strings, but I'm not sure if there is any way to actually do this.
 
 
 |  |  
	| 04-15-2012, 02:00 AM |  |  
	
		| nemesis567   Posting Freak
 
 Posts: 874
 Threads: 65
 Joined: May 2011
 Reputation: 
10
 | 
			| RE: [CHALLENGE THREAD] 
 
				There is.
 
  Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
 |  |  
	| 04-15-2012, 02:03 AM |  |  
	
		| Homicide13   Senior Member
 
 Posts: 323
 Threads: 41
 Joined: Nov 2010
 Reputation: 
14
 |  |  
	| 04-15-2012, 02:11 AM |  |  
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: [CHALLENGE THREAD] 
 
				 (04-15-2012, 01:53 AM)nemesis567 Wrote:  Suppose there is a class myClass and inside there is a memberFunction() which has the same name but is different in both functions.
 If I Aim a Base-Class Pointer at a Derived-Class Object and then use the pointer to call the function, supposedly the function called is the one from the derived class. But what happens if I aim a Derived-Class pointer to a Base-Class Object? Should it call the derived class function or won't it work? What if the member function of the derived class, calls another member function that only exists in the Base-Class?
 
I'm not entirely sure what you mean by "aim", but here's how inheritance works in terms of methods: So long as the derived class (subclass) doesn't redefine the parent method, then the parent definition of the method will be used for the derived class. If the method is redefined in the derived class, then the only way to call the parent's method when calling the same method from the derived class is by calling, e.g., BaseClass::memberFunction() within the redefined method.
 
Of course, in C++ we have the keyword virtual  which touches on this, but i won't get into that now.
  (04-15-2012, 02:00 AM)Homicide13 Wrote:  I have strings of single digit integers that I want the compiler to read as integers instead of strings, but I'm not sure if there is any way to actually do this.http://www.frictionalgames.com/forum/thr...l#pid87716 
 
				
(This post was last modified: 04-15-2012, 02:27 AM by Your Computer.)
 |  |  
	| 04-15-2012, 02:27 AM |  |  
	
		| nemesis567   Posting Freak
 
 Posts: 874
 Threads: 65
 Joined: May 2011
 Reputation: 
10
 | 
			| RE: [CHALLENGE THREAD] 
 
				I get it now. Thanks. Virtual function were a lot easier to understand, and probably the best thing to do when the method is different in the derived class' function.
 
  Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
 
				
(This post was last modified: 04-15-2012, 02:37 AM by nemesis567.)
 |  |  
	| 04-15-2012, 02:37 AM |  |  
	
		| Homicide13   Senior Member
 
 Posts: 323
 Threads: 41
 Joined: Nov 2010
 Reputation: 
14
 | 
			| RE: [CHALLENGE THREAD] 
 
				Are arrays supported in hpl2? I know it says here: http://www.angelcode.com/angelscript/sdk...rrays.html  that "Arrays are only available in the scripts if the application registers the support for them," and whenever I try to state the value of a member of an array, it returns weird errors.
 
For example, the code: 
 
int[] test(3,2); 
test[1] = 1;
 
returns the error: 
main(2,6) : ERR : Expected ']'
			
 
				
(This post was last modified: 04-15-2012, 02:46 AM by Homicide13.)
 |  |  
	| 04-15-2012, 02:45 AM |  |  |