David has over 40 years of industry experience in software development and information technology and a bachelor of computer science
C# vs. C++: Similarities & Differences
The Pervasiveness of Computers
Computers are a part of most aspects of our lives. If you don't agree, try to name an electronic item that doesn't contain one. Sure, it's possible. But it's getting more and more difficult, particularly with the recent Internet-of-Things movement. You know, that movement that wants to add everything we use to the connected world of the Internet! We're already seeing appliances like toasters and refrigerators that connect to the internet through your router. What's next? It makes sense that there is a need to control these items and provide them with instructions that define how they operate. One way to do this is through a programming language like C++ or C#.
What is C++?
C++ is an object-oriented computer programming language developed by Bjarne Stroustrup in 1979. By object-oriented, we mean that the language has the ability to define and manipulate a construct known as an object. An object is a collection of information that is combined with a specific set of operations that can be performed on the information. A classic example is that of a queue. Virtually everyone is familiar with this idea. We experience it when we stop for coffee in the morning at our favorite coffee shop. It is a first-in-first-out structure where new items are added at the back (enqueue), and old ones are removed from the front (dequeue).
What is C#?
C# is another example of an object-oriented programming language. Developed by Microsoft and released in 2002, it is much more recent than its older sibling, C++. It is also considered a general programming language, meaning that it can be applied to a number of programming tasks and problems. Today it is still quite popular, particularly for those things that use another of Microsoft's key technologies, .NET. Examples of its use fall into areas like:
- Desktop Applications - These include standalone applications that run on your desktop computer like Microsoft Word.
- Web Applications - These are applications that run in your web browser, such as Chrome or Internet Explorer. Google Search is also an example of this kind of application.
- Mobile Applications - These are the apps on your cell phone or tablet. There are many examples available, like Flipboard.
How Are These Languages Similar?
These two languages are similar in a number of ways. The three most significant similarities are as follows:
- C Language Derivatives - This refers to the syntax, the arrangement of keywords and symbols that make up the language. It is based on the C programming language.
- Object Oriented - This means that they support classes, inheritance (the ability to create a new object from existing objects), and polymorphism (the ability of an operation to adjust to the uniqueness of an object at run-time).
- Compiled - This means that the language statements must be run through a processing step (compiling) before they can be executed in a computer.
How Are These Languages Different?
Although they are similar in many ways, there are a number of differences between the two languages. Most are syntax specific and will be caught by the Integrated Development Environment (IDE) you are using, or at compile time, so you don't have to overly concern yourself with them. But there are a couple worth noting because they can affect how you write your programs.
- C# is Memory Managed - The system will handle the deallocation and cleanup of memory (garbage collection). This can simplify this process, but the timeframe is NOT guaranteed.
- C# is Type-Safe - The system closely monitors any operation to ensure that apples and oranges don't mix. This means that conversions between types must be explicit.
- C# Doesn't Rely on Pointers - Pointers are allowed, but the system treats them uniquely as they aren't type-safe.
- C# Strings are Immutable - Once assigned, their values can't be changed. In C++, strings are character arrays that can be manipulated as any array would.
Lesson Summary
To recap, C++ and C# are object-oriented computer programming languages. Object-oriented means the ability to define and manipulate a construct known as an object. An object is a collection of information and the operations that can be performed on the information. The two languages are similar in that they are C language derivatives, they are object oriented, and they are compiled. They differ in that C# is memory managed, C# is type-safe, C# doesn't rely on pointers, and C# strings are immutable.
To unlock this lesson you must be a Study.com Member.
Create your account
Register to view this lesson
Unlock Your Education
See for yourself why 30 million people use Study.com
Become a Study.com member and start learning now.
Become a MemberAlready a member? Log In
BackC# vs. C++: Similarities & Differences
Related Study Materials
- Computer Science: Help and Review
- General History Lessons
- General Science Lessons
- TExES Science of Teaching Reading (293): Practice & Study Guide
- Next Gen NCLEX-PN Study Guide & Practice
- Musical Instrument Instruction
- Choral Instruction
- Curriculum & Assessment in Music Education
- Strategies for Music Instruction
- Introduction to War
- How to Pass the CDA Test
- What is the CDA Test?
- IAAP CAP Test Day Preparation
- ILTS Test Score Information
- IAAP CAP Registration Information
- IAAP CAP Test Retake Policy
- IAAP CAP Test Score Information
Latest Courses
- Role of the Skin in Homeostasis & Immunity
- Hijab: Definition and Relation to Islam
- Primary Source: The Treaty of Paris
- Ammit: Mythology, Hieroglyphics & Facts
- Foreign Tax Credits for Businesses: Eligibility & Deductability
- One Day When I Was Lost Summary
- Veterinary Plan of Action for Primates
- Quiz & Worksheet - Porfiry Petrovich in Crime and Punishment
- Quiz & Worksheet - What is RNA Editing?
- Quiz & Worksheet - Reconciling Subledger & General Ledger for Accounts Payable & Accrued Liabilities
- Quiz & Worksheet - Positions, Planes & Cavities Terms in Anatomy
- Flashcards - Real Estate Marketing Basics
- Flashcards - Promotional Marketing in Real Estate
- Social Awareness Teaching Resources
- Teaching Strategies | Instructional Strategies & Resources
Latest Lessons
- Precalculus: Tutoring Solution
- SAT Subject Test Literature: Practice and Study Guide
- The Civil War and Reconstruction: Help and Review
- High School Algebra I: Tutoring Solution
- Praxis Marketing Education (5561): Practice & Study Guide
- Environmental Ethics & Politics
- McDougal Littell World History Chapter 20: The Atlantic World
- Quiz & Worksheet - Socrates, Plato & Augustine on the Immortal Soul
- Quiz & Worksheet - Extortion & Law
- Quiz & Worksheet - Economics of National Security Policy
- Quiz & Worksheet - Reflexive Property of Congruence
- Quiz & Worksheet - Genomic Imprinting
Popular Courses
- The Double Angle Formula
- Co-Occuring Disorders in Addiction Counseling
- What Are Common SAT Essay Topics?
- Persuasive Writing Prompts: 4th Grade
- 6th Grade Writing Prompts
- What is a Good PSAT Score for a Junior?
- 13 Colonies Lesson Plan
- Kindergarten Math Journals
- Story Elements Lesson Plan
- What Is the IELTS Academic Test?
- What Is the OET?
- What is the CFA Exam? - Levels I, II & III
Popular Lessons
Math
Social Sciences
Science
Business
Humanities
Education
History
Art and Design
Tech and Engineering
- Tech and Engineering - Videos
- Tech and Engineering - Quizzes
- Tech and Engineering - Questions & Answers