LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2012, 09:52 AM   #1
5883
Member
 
Registered: Aug 2004
Posts: 173

Rep: Reputation: 0
how to apply OOD to a code for both win and linux platform


we used to use
#if LINUX

#elseif WINCE

#endif


can we use classes in c++ to get rid of that ?

i mean base class, then linux derived class, and wince class ?
 
Old 10-15-2012, 09:18 AM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
There's the C++ language and there's the preprocessor. Both have their place in software development. To put it simply, classes, inheritance and polymorphism are used to solve problems which need to be resolved at run-time. Preprocessor can be used to solve problems that need to be resolved at compile-time. If you define derived classes for different environments, your code will probably not even compile, because the windows code won't compile on linux and vice versa. There probably are cases where it could work, such as if the reason for different approaches on different platforms is the methods' efficiency, rather than their availability, but in most cases, the #ifs are the way to go.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Best linux to use with win 7 platform chesson Linux - Newbie 1 02-03-2012 02:11 AM
cross platform(Win/Linux) LAN chat software austinium Linux - Software 1 03-05-2010 07:20 AM
ood books on learning (beginning) php, mysql, and apache in a linux enviroment? CoffeeKing!!! Linux - Newbie 5 08-31-2008 03:16 PM
LXer: iWave announces low cost ARM Platform with Linux and Win CE.Net LXer Syndicated Linux News 0 07-17-2006 06:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration