View unanswered posts | View active topics It is currently Tue Jun 18, 2013 12:48 am






Reply to topic  [ 2 posts ] 
Class Files 
Author Message
Rookie

Joined: Fri May 20, 2011 6:01 pm
Posts: 20
Post Class Files
I am working on several projects right now revolving around object oriented C, and i would like to be able to develop a set of classes that could be added to programs and accessed easily using "#include ...", but i am having several problems, specifically, i don't know what kind of file i should create, should i use a ".h" file? a ".cpp" file? and once i have the file, what should i do to make the classes usable? do i have to "#define ..." like in regular header files? please help. Also, is it possible to create user functions, like in PHP or JavaScript, for example:

Code:
function foo(int a, bool b){
       //code to be executed
}


thanks,

chris


Wed Oct 19, 2011 4:37 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1023
Post Re: Class Files
It's not clear to me whether you are implementing your object classes using RobotC or some other object oriented C languages? If you are trying to implement object classes using RobotC, there are a lot of restrictions on RobotC, the major one being no real pointer support. I implemented my own object oriented library using RobotC, so it is possible but some tricks are required such as using pass-by-reference of structures. I implemented all my object classes using .h files and include them in my main C file. Regarding creating user functions, all languages I know support it.


Wed Oct 19, 2011 5:29 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.