Jump to content

Switching from C to C++: Difference between revisions

From IdeaWazaWiki
wikademia>McCormack
No edit summary
wikademia>Gbaor
cat. change
Line 22: Line 22:


[[Category:Programming]]
[[Category:Programming]]
[[Category:Programming Languages]]
[[Category:C programming language family]]

Revision as of 09:29, 31 July 2008


Switching from C to C++
PrerequireSome understanding of C and C++
ExperienceIntermediate
Lesson Description
Differences between C++ and C
What you will learn
  1. How C++ is different from C


Some believe that learning C++ is easy and suggest learning C before learning C++, while other people disagree and believe that if your intention is to learn C++ that you are better off learning C++ directly rather than trying to learn C first. Switching from C to C++ can be both easy, as there are many similarities between the two languages, and hard, as there are many differences that require forgetting what you know and habits that you may have developed from programming in C.

Differences

  • C++ uses new and delete operators for memory management while C uses library functions.
  • C++ extends structs and unions, and also includes classes.
  • C++ has templates while C does not.
  • C++ has operator and function overloading.
  • C++ has different requirements for type conversions and alternative type conversion semantics.
  • typedef creates unique types in C++, and creates type aliasing in C.