| Author |
Message
|
| LegalEagle |
Posted: Fri May 09, 2008 9:28 pm Post subject: Is C a subset of C++? |
|
|
Forum Freshman

Joined: 06 Apr 2008 Posts: 34
|
| I know C, and I also know some C++, and I think all of C can be used in C++, but not vice versa. So, I have to ask, is C a subset of C++? |
|
| Back to top |
|
 |
| CShark |
Posted: Sat May 10, 2008 6:19 am Post subject: |
|
|
 Forum Sophomore

Joined: 08 May 2008 Posts: 169 Location: East Coast of Canada
|
| The short answer is Yes, C is a subset of C++. It's really the other way round, C++ being an Object Oriented version of C. Once you start coding in C++, you see (no pun intended) how powerful and simpler C++ is. |
|
| Back to top |
|
 |
| LegalEagle |
Posted: Sat May 10, 2008 6:25 am Post subject: |
|
|
Forum Freshman

Joined: 06 Apr 2008 Posts: 34
|
| I think you're right. I took some courses in both languages a few years ago, and C++ is a superset of C. I belong to the school of thought that says that you should learn C before learning C++. |
|
| Back to top |
|
 |
| marnixR |
Posted: Sat May 10, 2008 2:04 pm Post subject: |
|
|
 Forum Cosmic Wizard

Joined: 10 Apr 2007 Posts: 2436 Location: Cardiff, Wales
|
C came first, and C++ is an object orientated improvement on C (the name C++ is actually a geek joke, meaning C = C + 1, geddit ?) _________________ if you find this place too crowded or too confrontational, how about trying Philosophorum,
the amicable forum where small is beautiful and even the trolls are intelligent
biology without evolution is but stamp collecting |
|
| Back to top |
|
 |
| CShark |
Posted: Sat May 10, 2008 3:54 pm Post subject: |
|
|
 Forum Sophomore

Joined: 08 May 2008 Posts: 169 Location: East Coast of Canada
|
er....yeah, C++ did come after C. As for learning which first, trying to understand C++ before C may be a bit more than you can chew. You may wish to start with basic (any flavour will do) before moving to C.
Read up on OOP as well (as previously mentioned). We can do the compiler-wars at that stage! |
|
| Back to top |
|
 |
| LegalEagle |
Posted: Sat May 10, 2008 4:06 pm Post subject: |
|
|
Forum Freshman

Joined: 06 Apr 2008 Posts: 34
|
| I never took a course in Basic, but I have read some of the language a while ago, and I think it's neat. |
|
| Back to top |
|
 |
| ExecuZen I.T. |
Posted: Mon May 12, 2008 3:37 am Post subject: learning |
|
|
Forum Freshman

Joined: 12 May 2008 Posts: 4 Location: London, City
|
If you have not yet learnt either, then I would strongly recommend to go straight into C++ without learning C first. While it is true that C++ is a superset of C, and that virtually any legal C program is a legal C++ program, the leap from C to C++ is very significant. C++ benefited from its relationship to C for many years, as C programmers could ease into their use of C++. To really get the full benefit of C++, however, many programmers found they had to unlearn much of what they knew and learn a whole new way of conceptualizing and solving programming problems.
reference: http://newdata.box.sk/bx/c/ _________________ rmantell@execuzen.com |
|
| Back to top |
|
 |
| CShark |
Posted: Mon May 12, 2008 8:26 am Post subject: Re: learning |
|
|
 Forum Sophomore

Joined: 08 May 2008 Posts: 169 Location: East Coast of Canada
|
| ExecuZen I.T. wrote: |
If you have not yet learnt either, then I would strongly recommend to go straight into C++ without learning C first. While it is true that C++ is a superset of C, and that virtually any legal C program is a legal C++ program, the leap from C to C++ is very significant. C++ benefited from its relationship to C for many years, as C programmers could ease into their use of C++. To really get the full benefit of C++, however, many programmers found they had to unlearn much of what they knew and learn a whole new way of conceptualizing and solving programming problems.
reference: http://newdata.box.sk/bx/c/ |
I disagree. Having gone the C to C++ route, once I understood how objects worked, the rest was simple, because I had a good foundation in C.
Imagine trying to understand x == 10 ? y = 16 : y = 5; if you have never coded before. Trying to grasp syntax is one thing, applying it is another. As C is a subset, it makes sense to start 'small' and work your way up. |
|
| Back to top |
|
 |
| LegalEagle |
Posted: Mon May 12, 2008 2:20 pm Post subject: |
|
|
Forum Freshman

Joined: 06 Apr 2008 Posts: 34
|
| Quote: |
| As C is a subset, it makes sense to start 'small' and work your way up. |
Agreed. But I say that partly because that was the route I took - first I took Pascal, then C, then C++. |
|
| Back to top |
|
 |
| CShark |
Posted: Mon May 12, 2008 5:19 pm Post subject: |
|
|
 Forum Sophomore

Joined: 08 May 2008 Posts: 169 Location: East Coast of Canada
|
| LegalEagle wrote: |
| Quote: |
| As C is a subset, it makes sense to start 'small' and work your way up. |
Agreed. But I say that partly because that was the route I took - first I took Pascal, then C, then C++. |
Indeed. My reasoning was the same.
Never got into Pascal, except having to learn to declare a function when first picking up 'C' (Is that not originally from Pascal....?) |
|
| Back to top |
|
 |
|
|