SlideShare une entreprise Scribd logo
1  sur  50
PRESENTATION ON     C++ Vs C# BY: SHUBHRA  CHAUHAN
INTRODUCTION C++ was written by Bjarne  Stroustrup at Bell Labs during 1983-1985. C++ is an extension of c. C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg.
OOPs CONCEPT IN C++ AND C++ The basic concepts of oops used in c++  and c#  are as follows: Objects Classes Data abstraction Encapsulation Inheritance Polymorphism
OBJECTS When a program is executed, the objects interact by sending messages to one another. For example, if ‘customer’ and ‘account’ are two objects in a program, then the customer object may send message to account object requesting for a bank balance. Each object contains data and code to manipulate data. CLASS objects contain data and function or code to manipulate that data. The entire set of data and code of an object can be made a user-defined data type with the help of a class. In fact objects are variables of type class. Once a class has been defined, we can create any number of objects associated with that class.
PROGRAM TO ADD TWO NUMBERS USING CLASS IN C++ #include<iostream.h> #include<conio.h> class add { public: void sum(int,int); }; void add::sum(int a,int b) { int s; s=a+b; cout<<”sum is:”<<s; } void main() { add ob1; ob1.sum(6,8); getch(); } Output: sum is:14 Member function Object ob1  of  class add
CLASS IN C# The class is the most important element in C# because everything must be included inside a class . Unlike other languages, the C# compiler doesn’t allow you to declare any variables or methods outside a class. In fact, object-oriented programming is based on the concept of classes. Structs are similar to classes in some aspects and can be used instead of classes in some applications. The main difference between a class and a struct is that the class is a reference type, while the struct is a value type.
CLASS DECLARATION We  declare a class by using the keyword class as follows: class MyClass { // Class implementation } The class implementation (or class body) goes between the braces ({}).
FIELD INITIALIZATION In the following example, we declare the class Point, which contains two fields — x and y: class Point { int x; int y; } We can initialize the fields with values like this example: class Point { int x = 0; int y = 0; } This declaration initializes the fields x and y to their default values.
CLASS INSTANTIATION To create objects from the Point class, use the following statement: Point myPoint;  // create the object We  can also create the object and initialize the fields in the same statement: Point myPoint = new Point(); In the second statement, when the object is created the default constructor is invoked to initialize fields to their default values. Then we can assign each object its own coordinates: p1.x = 15; p1.y = 22;
Using system; class  A { private string name; private void show() { console.write(“welcome to c#”); } public static void main(string [ ] arg) { A obj=new a(); obj.name=arg[0]; obj.show();} } Class name field method Method body Class method Local variable Method invocation Method parameters CLASS EXAMPLE
C#: MAIN METHOD() Main must  –  be named Main  –  return void or int –  be static  –  have (void) or (string[]) parameters public static void Main() { // Main } public static int Main(string[] args) { // Main return result_code; } public static void Main(string[] args) { // Main }
PROGRAM TO ADD TWO NUMBERS USING CLASS IN C# using System; namespace add_num { class sum { static void Main(string[] args) { int a, b,c; Console.WriteLine(&quot;Enter the first no. :&quot;); a = Int32.Parse(Console.ReadLine()); Console.WriteLine(&quot;Enter the second no :&quot;); b = Int32.Parse(Console.ReadLine()); c = a + b; Console.WriteLine(&quot;total :&quot; + c); Console.ReadLine(); } } } Output: Enter the first no.:6 Enter the second no.:8 total: 14
DATA ABSTRACTION Abstraction refers to the act of representing essential features without including the background details. The concept of abstraction relates to the idea of hiding data that are not needed for presentation. The main idea behind data abstraction is to give a clear separation between properties of data type and the associated implementation details. ENCAPSULATION Encapsulation is the most basic concept of OOP. It is the way of combining both data and the functions that operate on that data under a single unit. The only way to access the data is provided by the functions .These functions are considered as member functions in C++. It is not possible to access the data directly.
INHERITANCE I t is the capability to define a new class in terms of an existing class. An existing class is known as a base class and the new class is known as derived class. Inheritance can be of following types: A B A B C A B C D SINGLE INHERITANCE MULTIPLE INHERITANCE HIEARCHICAL INHERITANCE
A B C A B C D MULTILEVEL INHERITANCE HYBRID INHERITANCE
SINGLE INHERITANCE If a class is derived from a single base class, it is called as single inheritance. SYNTAX: class derived_class_name : access_specifier base_class_name { data members of the derived class ; member functions of the derived class ; }; The colon (:), indicates that the class derived_class_name is derived from the class base_class_name. The access_specifier may be public, private or protected. If no access_specifier is specified, it is private by default. The access_specifier indicates whether the members of the base class are privately derived or publicly derived.
MULTIPLE INHERITANCE If a class is derived from more than one base class, it is known as multiple inheritance SYNTAX class derived-class-name : access_specifier Baseclass1, access_specifier Baseclass2, ……… …… .. access_specifier Baseclass_n { members of the derived class ; };
Hierarchical Inheritance When two or more classes are derived from a single base class, then Inheritance is called the hierarchical inheritance. Syntax class derived_class_name1:visibility base_class_name { . . }; class derived_class_name2:visibility base_class_name { . . };
MULTILEVEL INHERITANCE In multilevel inheritance  the derived class can also be derived by an another class, which in turn can further be inherited by another and so on.  Syntax class derived_class_name1:visibility base_class_name { . . }; class derived_class_name2:visibility derived_class_name1 { . . };
PROGRAM USING SINGLE INHERITACE IN C++ #include<iostream.h> #include<conio.h> class  A { public: void add() { int a=5,b=4,s; s=a+b; } }; class B: public A { public: void show() { cout<<”sum is:”<<s; } //class B publically inherit class A//
}; void main() { B obj; obj.add(); obj.show(); getch(); } Output: sum is:9
MERITS OF INHERITANCE Increase reuse and software quality programmers reuse the base class instead of writing new class using well tested base class  helps reduce bugs in applications  that use them Reduce object code size Enhance extensibility and comprehensibility helps support more flexible and extensible architectures  often useful for modeling and classifying hierarchically- related domains
DEMERITS OF INHERITANCE May create deep hierarchies  that  are difficult to understand. May decrease performance slightly. Subclass become dependent on parent class implementation. Complexity for very small programs.
INHERITANCE IN C# C# supports two types of Inheritance mechanisms 1) Implementation Inheritance When a class (type) is derived  from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance 2) Interface Inheritance When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance.
PROGRAM USING SINGLE INHERITANCE IN C# using System;  class A {  public int x = 10;  public int y = 20;  }  class B : A  {  public int z = 30;  public void Sum()  {  int sum = x+y+z;  Console.WriteLine(“sum is:{0}”,sum);  }  }
class add  {  public static void Main()  {  Derived d1 = new Derived();  d1.Sum(); }  }  Output: sum is: 60
MERITS OF INHERITANCE IN C# Through inheritance you can very easily convert small system into large systems You can have  lots of classes with the same root but have different implementations of classes. Code reusability through inheritance increased. Code are easy to manage and divided into parent and child classes.
DEMERITS OF INHERITANCE IN C# We can't change the implementation inherited from super classes at runtime (obviously because inheritance is defined at compile time). Inheritance exposes a subclass to details of its parent's class implementation, that's whey it's often said that inheritance breaks encapsulation (in a sense that you really need to focus on interfaces only not implementation, so reusing by sub classing is not always preferred). The tight coupling provided by inheritance makes the implementation of a subclass very bound up with the implementation of a super class that any change in the parent implementation will force the sub class to change. Excessive reusing by sub-classing can make the inheritance stack very deep and very confusing too.
POLYMORPHISM Polymorphism is a key to the power of OOP. It is the concept that supports the capability of data to be processed in more than one form. For example, an operation may exhibit different behaviour in different instances. The behaviour depends upon the types of data used in the operation. Let us consider the operation of addition.For two numbers, the operation will generate a sum. If the operands are strings then the operation would produce a third string by concatenation. Polymorphism is of two types: Compile time Run time
COMPILE TIME POLYMORPHISM Compile time polymorphism is method and operators overloading. It is also called early binding. Method with same name but with different arguments is called method overloading. In method overloading, method performs the different task at the different input parameters. EXAMPLE OF METHOD OVERLOADING class A1 { void hello() { Console.WriteLine(“WELCOME”); } void hello(string s) { Console.WriteLine(“WELCOME {0}”,s); } }
RUN TIME POLYMORPHISM Runtime time polymorphism is done using inheritance and virtual functions. Method overriding is called runtime polymorphism. It is also called late binding. Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one  of its superclass. When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same prototype.Method overloading has nothing to do with inheritance or virtual methods.
EXAMPLE OF METHOD OVERRIDING Class parent { virtual void hello() { Console.WriteLine(“Hello from Parent”); } } class child:parent { override void hello() { Console.WriteLine(“Hello from Child”); } } static void main() { parent objParent = new child(); objParent.hello(); } Output Hello from Child.
DIFFRENCE BETWEEN INHERITANCE AND POLYMORPHISM Inheritance is the object oriented feature by which the functionality and features of one class are made available to another class without having to copy paste the code. Polymorphism is the object oriented feature by which multiple methods of a class can coexist with minor differences. Ex: method overloading.
SIMILARITIES BETWEEN C++ & C# Both supports pointers. Capable of defining pre-processor. Both supports structure. Both supports goto statement.
POINTER IN C++ A pointer is a variable that is used to store a memory address. The address is the location of the variable in the memory. Pointers help in allocating memory dynamically. The general form of declaring pointer is:- type *variable_name; type is the base type of the pointer and variable_name is the name of the variable of the pointer. Pointer Operators There are two important pointer operators such as ‘*’ and '&' .The ‘&’ is a unary operator. The unary operator returns the address of the memory where a variable is located.  The ‘*’ operator is called the indirection operator. It returns the contents of the memory location pointed to.  The indirection operator is also called deference operator.
PROGRAM USING POINTER #include<iostream.h> #include<conio.h> void main( ) { int *x; int c=100; x=&c; cout << &quot; The address of the memory location of x : &quot; << x <<endl; cout << &quot; The contents of the pointer x : &quot; << *x << endl; getch( ); } Output: The address of the memory location of x: 01212FF78 The contents of the pointer x: 100
POINTER IN C# Pointers are special kind of variables which hold addresses other variables.To create a pointer we  use the following declaration: type* variable_name;  As a type may be used each type that is not a reference-type and does not contain reference-type field. It can be only: sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool any enum-type. Pointer are only be used in unsafe context.
PROGRAM USING POINTER using System; class  A { public unsafe static void main() { int i=10; int *p; p=&x; console.WriteLine(“address is”+ p); console.WriteLine(“value is”+ *p); } } Output Address is 0012HM95 value is 10';
PREPROCESSOR IN C ++ The pre-processor is a utility program, which processes special instructions that can be or are written in a C++  program. These instructions can be include a library or some special instructions to the compiler about some certain terms used in the program. Pre-processor directives start with ‘#’ character.Pre-processor directives starts with # character. C++ supports the following preprocessor directives: #include #define #if #elif #else #endif #ifndef #ifdef #undef
PREPROCESSOR IN C# A preprocessor directive must be the only instruction on a line. Preprocessing directives are lines in your program that start with '#'. Whitespace is allowed before and after the '#'. The '#' is followed by an identifier that is the directive name. For example, '#define' is the directive . The C# language's preprocessor directives are as follows: #if #else #elif #endif #define #undef #error #line
STRUCTURE Structure is a collection of variables under a single name. Variables can be of any type: int, float, char etc.   Declaring a Structure: The structure is declared by using the keyword struct followed by structure name, also called a tag. Then the structure members (variables) are defined with their type and variable names inside the open and close braces { and } . Finally, the closed braces end with a semicolon denoted as ; following the statement. Struct student { char name[20]; int marks; int total; }; Keyword Structure name Structure member
Goto statement The goto statement  translates the program control directly to a labeled statement. It takes following form: goto identifier; goto case const-exp.; goto default;
DIFFERENCES BETWEEN C++ AND C# Most of the C# features are similar to those of C++. However, C# provides various additional features that make it a more type –safe and web enabled language. Various points of different between C# and C++ are : C# does not use semicolon at the end of class definition. C# does not contain any default constructor. Objects in C# can only be created using new keywords. C# does not support multiple inheritance C# does not support the header file,# include. Continue..
Continue... C++ supports operator overloading but C# does not. C++ is not completely object oriented based but C# is completely object oriented. C# have garbage collection capability but it is absent in C++ . C++ is statically typed whereas C# is dynamic in nature. C# is high level programming language while C++ is a middle level programming language.
ADVANTAGES OF C++ Better performance Portability Multiple inheritance Support for global variables, function and constants
DISADVANTAGE OF C++ Complex in very large high level program. C++ can't support garbage collection. C++ is not secure because it have pointer, friend function and global variable. When C++ used for web applications complex and difficult to debug .
ADVANTAGES OF C# Garbage collection Huge .NET framework library Supports constructor chaining No need for header files and #include Access to class members/ function is done only by the dot(. )
DISADVANTAGE OF C# C# is less flexible than C++.  C# depends greatly on .NET framework, anything that is not found in the .NET framework will be difficult to implement. All though portability is what with C# was developed, C# programs are largely for Microsoft Windows Environment which although happens to be the most widely used Operating system over the globe, but with Open Source technologies, especially platforms like Linux catching up, C# still has to long way to go. This is one major shortcoming of C# . Although C# programs can be written as little as a text editor and compiled using command line, it still needs the .NET framework to be present on the system, which cripples down the portability in the development of C# programs by a large amount, and makes it more Microsoft Windows dependent.
CONCLUSION While there are a number of differences between C++ and C#, the syntax of C# is not very different from C++ and the transition to the new language is more easy with  .NET framework. Also .NET's cross language interoperability can give us  the ability to use C++ and C# together Finally, if we want to use a strong programming language like C++ with the simplicity of VB  than we  can use C# powered  with CLR.
REFERENCES www.google.com www.msdnmicrosoft.com www.wikipedia.org

Contenu connexe

Tendances

Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
What is Tuple in python? | Python Tuple Tutorial | Edureka
What is Tuple in python? | Python Tuple Tutorial | EdurekaWhat is Tuple in python? | Python Tuple Tutorial | Edureka
What is Tuple in python? | Python Tuple Tutorial | EdurekaEdureka!
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventuremylittleadventure
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewMarkus Schneider
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonAgung Wahyudi
 
Postman tests in jenkins
Postman tests in jenkinsPostman tests in jenkins
Postman tests in jenkinsAlex Galkin
 
Présentation de Robot framework
Présentation de Robot frameworkPrésentation de Robot framework
Présentation de Robot frameworkgilleslenfant
 
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | EdurekaPython Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | EdurekaEdureka!
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)ShubhamMishra485
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to SwiftGiordano Scalzo
 
POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE teachersduniya.com
 

Tendances (20)

Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Python
PythonPython
Python
 
What is Tuple in python? | Python Tuple Tutorial | Edureka
What is Tuple in python? | Python Tuple Tutorial | EdurekaWhat is Tuple in python? | Python Tuple Tutorial | Edureka
What is Tuple in python? | Python Tuple Tutorial | Edureka
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
 
Testing in go
Testing in goTesting in go
Testing in go
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
Go lang
Go langGo lang
Go lang
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Postman tests in jenkins
Postman tests in jenkinsPostman tests in jenkins
Postman tests in jenkins
 
Présentation de Robot framework
Présentation de Robot frameworkPrésentation de Robot framework
Présentation de Robot framework
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | EdurekaPython Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
 
Python Presentation
Python PresentationPython Presentation
Python Presentation
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Embedded System Test Automation
Embedded System Test AutomationEmbedded System Test Automation
Embedded System Test Automation
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
 
POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE
 

En vedette

C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#sudipv
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#Sireesh K
 
C# for C++ Programmers
C# for C++ ProgrammersC# for C++ Programmers
C# for C++ Programmersrussellgmorley
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#Sagar Pednekar
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To DotnetSAMIR BHOGAYTA
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
Difference between java and c#
Difference between java and c#Difference between java and c#
Difference between java and c#TECOS
 
Summer training in c++
Summer training in c++Summer training in c++
Summer training in c++DUCC Systems
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREjatin batra
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming CourseDennis Chang
 
Difference between c# generics and c++ templates
Difference between c# generics and c++ templatesDifference between c# generics and c++ templates
Difference between c# generics and c++ templatesUmar Ali
 

En vedette (20)

C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
Differences between c and c++
Differences between c and c++Differences between c and c++
Differences between c and c++
 
C vs c++
C vs c++C vs c++
C vs c++
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
C vs c++
C vs c++C vs c++
C vs c++
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
C# for C++ Programmers
C# for C++ ProgrammersC# for C++ Programmers
C# for C++ Programmers
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
Java vs .Net
Java vs .NetJava vs .Net
Java vs .Net
 
C# basics
 C# basics C# basics
C# basics
 
Brain chips
Brain chipsBrain chips
Brain chips
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To Dotnet
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
Difference between java and c#
Difference between java and c#Difference between java and c#
Difference between java and c#
 
Summer training in c++
Summer training in c++Summer training in c++
Summer training in c++
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
 
Difference between c# generics and c++ templates
Difference between c# generics and c++ templatesDifference between c# generics and c++ templates
Difference between c# generics and c++ templates
 

Similaire à Ppt of c++ vs c#

Similaire à Ppt of c++ vs c# (20)

C++ presentation
C++ presentationC++ presentation
C++ presentation
 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Inheritance
InheritanceInheritance
Inheritance
 
Introduction to object oriented programming concepts
Introduction to object oriented programming conceptsIntroduction to object oriented programming concepts
Introduction to object oriented programming concepts
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
 
Inheritance
InheritanceInheritance
Inheritance
 
C++ Notes
C++ NotesC++ Notes
C++ Notes
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
Unit 3 notes.pdf
Unit 3 notes.pdfUnit 3 notes.pdf
Unit 3 notes.pdf
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
My c++
My c++My c++
My c++
 
Interfaces c#
Interfaces c#Interfaces c#
Interfaces c#
 
Synapseindia dot net development
Synapseindia dot net developmentSynapseindia dot net development
Synapseindia dot net development
 
Chapter 5 (OOP Principles).ppt
Chapter 5 (OOP Principles).pptChapter 5 (OOP Principles).ppt
Chapter 5 (OOP Principles).ppt
 
Class notes(week 6) on inheritance and multiple inheritance
Class notes(week 6) on inheritance and multiple inheritanceClass notes(week 6) on inheritance and multiple inheritance
Class notes(week 6) on inheritance and multiple inheritance
 
chapter-10-inheritance.pdf
chapter-10-inheritance.pdfchapter-10-inheritance.pdf
chapter-10-inheritance.pdf
 
Inheritance.pptx
Inheritance.pptxInheritance.pptx
Inheritance.pptx
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 

Dernier

Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphNetziValdelomar1
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxDr. Asif Anas
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfYu Kanazawa / Osaka University
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...raviapr7
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...CaraSkikne1
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 

Dernier (20)

Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a Paragraph
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptx
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdfPersonal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 

Ppt of c++ vs c#

  • 1. PRESENTATION ON C++ Vs C# BY: SHUBHRA CHAUHAN
  • 2. INTRODUCTION C++ was written by Bjarne Stroustrup at Bell Labs during 1983-1985. C++ is an extension of c. C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg.
  • 3. OOPs CONCEPT IN C++ AND C++ The basic concepts of oops used in c++ and c# are as follows: Objects Classes Data abstraction Encapsulation Inheritance Polymorphism
  • 4. OBJECTS When a program is executed, the objects interact by sending messages to one another. For example, if ‘customer’ and ‘account’ are two objects in a program, then the customer object may send message to account object requesting for a bank balance. Each object contains data and code to manipulate data. CLASS objects contain data and function or code to manipulate that data. The entire set of data and code of an object can be made a user-defined data type with the help of a class. In fact objects are variables of type class. Once a class has been defined, we can create any number of objects associated with that class.
  • 5. PROGRAM TO ADD TWO NUMBERS USING CLASS IN C++ #include<iostream.h> #include<conio.h> class add { public: void sum(int,int); }; void add::sum(int a,int b) { int s; s=a+b; cout<<”sum is:”<<s; } void main() { add ob1; ob1.sum(6,8); getch(); } Output: sum is:14 Member function Object ob1 of class add
  • 6. CLASS IN C# The class is the most important element in C# because everything must be included inside a class . Unlike other languages, the C# compiler doesn’t allow you to declare any variables or methods outside a class. In fact, object-oriented programming is based on the concept of classes. Structs are similar to classes in some aspects and can be used instead of classes in some applications. The main difference between a class and a struct is that the class is a reference type, while the struct is a value type.
  • 7. CLASS DECLARATION We declare a class by using the keyword class as follows: class MyClass { // Class implementation } The class implementation (or class body) goes between the braces ({}).
  • 8. FIELD INITIALIZATION In the following example, we declare the class Point, which contains two fields — x and y: class Point { int x; int y; } We can initialize the fields with values like this example: class Point { int x = 0; int y = 0; } This declaration initializes the fields x and y to their default values.
  • 9. CLASS INSTANTIATION To create objects from the Point class, use the following statement: Point myPoint; // create the object We can also create the object and initialize the fields in the same statement: Point myPoint = new Point(); In the second statement, when the object is created the default constructor is invoked to initialize fields to their default values. Then we can assign each object its own coordinates: p1.x = 15; p1.y = 22;
  • 10. Using system; class A { private string name; private void show() { console.write(“welcome to c#”); } public static void main(string [ ] arg) { A obj=new a(); obj.name=arg[0]; obj.show();} } Class name field method Method body Class method Local variable Method invocation Method parameters CLASS EXAMPLE
  • 11. C#: MAIN METHOD() Main must – be named Main – return void or int – be static – have (void) or (string[]) parameters public static void Main() { // Main } public static int Main(string[] args) { // Main return result_code; } public static void Main(string[] args) { // Main }
  • 12. PROGRAM TO ADD TWO NUMBERS USING CLASS IN C# using System; namespace add_num { class sum { static void Main(string[] args) { int a, b,c; Console.WriteLine(&quot;Enter the first no. :&quot;); a = Int32.Parse(Console.ReadLine()); Console.WriteLine(&quot;Enter the second no :&quot;); b = Int32.Parse(Console.ReadLine()); c = a + b; Console.WriteLine(&quot;total :&quot; + c); Console.ReadLine(); } } } Output: Enter the first no.:6 Enter the second no.:8 total: 14
  • 13. DATA ABSTRACTION Abstraction refers to the act of representing essential features without including the background details. The concept of abstraction relates to the idea of hiding data that are not needed for presentation. The main idea behind data abstraction is to give a clear separation between properties of data type and the associated implementation details. ENCAPSULATION Encapsulation is the most basic concept of OOP. It is the way of combining both data and the functions that operate on that data under a single unit. The only way to access the data is provided by the functions .These functions are considered as member functions in C++. It is not possible to access the data directly.
  • 14. INHERITANCE I t is the capability to define a new class in terms of an existing class. An existing class is known as a base class and the new class is known as derived class. Inheritance can be of following types: A B A B C A B C D SINGLE INHERITANCE MULTIPLE INHERITANCE HIEARCHICAL INHERITANCE
  • 15. A B C A B C D MULTILEVEL INHERITANCE HYBRID INHERITANCE
  • 16. SINGLE INHERITANCE If a class is derived from a single base class, it is called as single inheritance. SYNTAX: class derived_class_name : access_specifier base_class_name { data members of the derived class ; member functions of the derived class ; }; The colon (:), indicates that the class derived_class_name is derived from the class base_class_name. The access_specifier may be public, private or protected. If no access_specifier is specified, it is private by default. The access_specifier indicates whether the members of the base class are privately derived or publicly derived.
  • 17. MULTIPLE INHERITANCE If a class is derived from more than one base class, it is known as multiple inheritance SYNTAX class derived-class-name : access_specifier Baseclass1, access_specifier Baseclass2, ……… …… .. access_specifier Baseclass_n { members of the derived class ; };
  • 18. Hierarchical Inheritance When two or more classes are derived from a single base class, then Inheritance is called the hierarchical inheritance. Syntax class derived_class_name1:visibility base_class_name { . . }; class derived_class_name2:visibility base_class_name { . . };
  • 19. MULTILEVEL INHERITANCE In multilevel inheritance the derived class can also be derived by an another class, which in turn can further be inherited by another and so on. Syntax class derived_class_name1:visibility base_class_name { . . }; class derived_class_name2:visibility derived_class_name1 { . . };
  • 20. PROGRAM USING SINGLE INHERITACE IN C++ #include<iostream.h> #include<conio.h> class A { public: void add() { int a=5,b=4,s; s=a+b; } }; class B: public A { public: void show() { cout<<”sum is:”<<s; } //class B publically inherit class A//
  • 21. }; void main() { B obj; obj.add(); obj.show(); getch(); } Output: sum is:9
  • 22. MERITS OF INHERITANCE Increase reuse and software quality programmers reuse the base class instead of writing new class using well tested base class helps reduce bugs in applications that use them Reduce object code size Enhance extensibility and comprehensibility helps support more flexible and extensible architectures often useful for modeling and classifying hierarchically- related domains
  • 23. DEMERITS OF INHERITANCE May create deep hierarchies that are difficult to understand. May decrease performance slightly. Subclass become dependent on parent class implementation. Complexity for very small programs.
  • 24. INHERITANCE IN C# C# supports two types of Inheritance mechanisms 1) Implementation Inheritance When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance 2) Interface Inheritance When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance.
  • 25. PROGRAM USING SINGLE INHERITANCE IN C# using System; class A { public int x = 10; public int y = 20; } class B : A { public int z = 30; public void Sum() { int sum = x+y+z; Console.WriteLine(“sum is:{0}”,sum); } }
  • 26. class add { public static void Main() { Derived d1 = new Derived(); d1.Sum(); } } Output: sum is: 60
  • 27. MERITS OF INHERITANCE IN C# Through inheritance you can very easily convert small system into large systems You can have lots of classes with the same root but have different implementations of classes. Code reusability through inheritance increased. Code are easy to manage and divided into parent and child classes.
  • 28. DEMERITS OF INHERITANCE IN C# We can't change the implementation inherited from super classes at runtime (obviously because inheritance is defined at compile time). Inheritance exposes a subclass to details of its parent's class implementation, that's whey it's often said that inheritance breaks encapsulation (in a sense that you really need to focus on interfaces only not implementation, so reusing by sub classing is not always preferred). The tight coupling provided by inheritance makes the implementation of a subclass very bound up with the implementation of a super class that any change in the parent implementation will force the sub class to change. Excessive reusing by sub-classing can make the inheritance stack very deep and very confusing too.
  • 29. POLYMORPHISM Polymorphism is a key to the power of OOP. It is the concept that supports the capability of data to be processed in more than one form. For example, an operation may exhibit different behaviour in different instances. The behaviour depends upon the types of data used in the operation. Let us consider the operation of addition.For two numbers, the operation will generate a sum. If the operands are strings then the operation would produce a third string by concatenation. Polymorphism is of two types: Compile time Run time
  • 30. COMPILE TIME POLYMORPHISM Compile time polymorphism is method and operators overloading. It is also called early binding. Method with same name but with different arguments is called method overloading. In method overloading, method performs the different task at the different input parameters. EXAMPLE OF METHOD OVERLOADING class A1 { void hello() { Console.WriteLine(“WELCOME”); } void hello(string s) { Console.WriteLine(“WELCOME {0}”,s); } }
  • 31. RUN TIME POLYMORPHISM Runtime time polymorphism is done using inheritance and virtual functions. Method overriding is called runtime polymorphism. It is also called late binding. Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass. When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same prototype.Method overloading has nothing to do with inheritance or virtual methods.
  • 32. EXAMPLE OF METHOD OVERRIDING Class parent { virtual void hello() { Console.WriteLine(“Hello from Parent”); } } class child:parent { override void hello() { Console.WriteLine(“Hello from Child”); } } static void main() { parent objParent = new child(); objParent.hello(); } Output Hello from Child.
  • 33. DIFFRENCE BETWEEN INHERITANCE AND POLYMORPHISM Inheritance is the object oriented feature by which the functionality and features of one class are made available to another class without having to copy paste the code. Polymorphism is the object oriented feature by which multiple methods of a class can coexist with minor differences. Ex: method overloading.
  • 34. SIMILARITIES BETWEEN C++ & C# Both supports pointers. Capable of defining pre-processor. Both supports structure. Both supports goto statement.
  • 35. POINTER IN C++ A pointer is a variable that is used to store a memory address. The address is the location of the variable in the memory. Pointers help in allocating memory dynamically. The general form of declaring pointer is:- type *variable_name; type is the base type of the pointer and variable_name is the name of the variable of the pointer. Pointer Operators There are two important pointer operators such as ‘*’ and '&' .The ‘&’ is a unary operator. The unary operator returns the address of the memory where a variable is located. The ‘*’ operator is called the indirection operator. It returns the contents of the memory location pointed to. The indirection operator is also called deference operator.
  • 36. PROGRAM USING POINTER #include<iostream.h> #include<conio.h> void main( ) { int *x; int c=100; x=&c; cout << &quot; The address of the memory location of x : &quot; << x <<endl; cout << &quot; The contents of the pointer x : &quot; << *x << endl; getch( ); } Output: The address of the memory location of x: 01212FF78 The contents of the pointer x: 100
  • 37. POINTER IN C# Pointers are special kind of variables which hold addresses other variables.To create a pointer we use the following declaration: type* variable_name; As a type may be used each type that is not a reference-type and does not contain reference-type field. It can be only: sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool any enum-type. Pointer are only be used in unsafe context.
  • 38. PROGRAM USING POINTER using System; class A { public unsafe static void main() { int i=10; int *p; p=&x; console.WriteLine(“address is”+ p); console.WriteLine(“value is”+ *p); } } Output Address is 0012HM95 value is 10';
  • 39. PREPROCESSOR IN C ++ The pre-processor is a utility program, which processes special instructions that can be or are written in a C++ program. These instructions can be include a library or some special instructions to the compiler about some certain terms used in the program. Pre-processor directives start with ‘#’ character.Pre-processor directives starts with # character. C++ supports the following preprocessor directives: #include #define #if #elif #else #endif #ifndef #ifdef #undef
  • 40. PREPROCESSOR IN C# A preprocessor directive must be the only instruction on a line. Preprocessing directives are lines in your program that start with '#'. Whitespace is allowed before and after the '#'. The '#' is followed by an identifier that is the directive name. For example, '#define' is the directive . The C# language's preprocessor directives are as follows: #if #else #elif #endif #define #undef #error #line
  • 41. STRUCTURE Structure is a collection of variables under a single name. Variables can be of any type: int, float, char etc. Declaring a Structure: The structure is declared by using the keyword struct followed by structure name, also called a tag. Then the structure members (variables) are defined with their type and variable names inside the open and close braces { and } . Finally, the closed braces end with a semicolon denoted as ; following the statement. Struct student { char name[20]; int marks; int total; }; Keyword Structure name Structure member
  • 42. Goto statement The goto statement translates the program control directly to a labeled statement. It takes following form: goto identifier; goto case const-exp.; goto default;
  • 43. DIFFERENCES BETWEEN C++ AND C# Most of the C# features are similar to those of C++. However, C# provides various additional features that make it a more type –safe and web enabled language. Various points of different between C# and C++ are : C# does not use semicolon at the end of class definition. C# does not contain any default constructor. Objects in C# can only be created using new keywords. C# does not support multiple inheritance C# does not support the header file,# include. Continue..
  • 44. Continue... C++ supports operator overloading but C# does not. C++ is not completely object oriented based but C# is completely object oriented. C# have garbage collection capability but it is absent in C++ . C++ is statically typed whereas C# is dynamic in nature. C# is high level programming language while C++ is a middle level programming language.
  • 45. ADVANTAGES OF C++ Better performance Portability Multiple inheritance Support for global variables, function and constants
  • 46. DISADVANTAGE OF C++ Complex in very large high level program. C++ can't support garbage collection. C++ is not secure because it have pointer, friend function and global variable. When C++ used for web applications complex and difficult to debug .
  • 47. ADVANTAGES OF C# Garbage collection Huge .NET framework library Supports constructor chaining No need for header files and #include Access to class members/ function is done only by the dot(. )
  • 48. DISADVANTAGE OF C# C# is less flexible than C++. C# depends greatly on .NET framework, anything that is not found in the .NET framework will be difficult to implement. All though portability is what with C# was developed, C# programs are largely for Microsoft Windows Environment which although happens to be the most widely used Operating system over the globe, but with Open Source technologies, especially platforms like Linux catching up, C# still has to long way to go. This is one major shortcoming of C# . Although C# programs can be written as little as a text editor and compiled using command line, it still needs the .NET framework to be present on the system, which cripples down the portability in the development of C# programs by a large amount, and makes it more Microsoft Windows dependent.
  • 49. CONCLUSION While there are a number of differences between C++ and C#, the syntax of C# is not very different from C++ and the transition to the new language is more easy with .NET framework. Also .NET's cross language interoperability can give us the ability to use C++ and C# together Finally, if we want to use a strong programming language like C++ with the simplicity of VB than we can use C# powered with CLR.