SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop pptdaxesh chauhan
 
Inline function
Inline functionInline function
Inline functionTech_MX
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Gajendra Singh Thakur
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vineeta Garg
 
Dynamic memory allocation in c++
Dynamic memory allocation in c++Dynamic memory allocation in c++
Dynamic memory allocation in c++Tech_MX
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methodsShubham Dwivedi
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingBurhan Ahmed
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++HalaiHansaika
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Vibhawa Nirmal
 
Inheritance ppt
Inheritance pptInheritance ppt
Inheritance pptNivegeetha
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#Doncho Minkov
 
Pointers, virtual function and polymorphism
Pointers, virtual function and polymorphismPointers, virtual function and polymorphism
Pointers, virtual function and polymorphismlalithambiga kamaraj
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 

Was ist angesagt? (20)

07. Virtual Functions
07. Virtual Functions07. Virtual Functions
07. Virtual Functions
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
 
Encapsulation C++
Encapsulation C++Encapsulation C++
Encapsulation C++
 
C# Encapsulation
C# EncapsulationC# Encapsulation
C# Encapsulation
 
Inline function
Inline functionInline function
Inline function
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Dynamic memory allocation in c++
Dynamic memory allocation in c++Dynamic memory allocation in c++
Dynamic memory allocation in c++
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners Object Oriented Programming Concepts for beginners
Object Oriented Programming Concepts for beginners
 
Inheritance ppt
Inheritance pptInheritance ppt
Inheritance ppt
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Pointers, virtual function and polymorphism
Pointers, virtual function and polymorphismPointers, virtual function and polymorphism
Pointers, virtual function and polymorphism
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
 
Oops
OopsOops
Oops
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 

Andere mochten auch

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
 
Power point presentation of saminer topic DNA based computing
Power point presentation of saminer topic  DNA based computingPower point presentation of saminer topic  DNA based computing
Power point presentation of saminer topic DNA based computingPaushali Sen
 

Andere mochten auch (20)

C++ vs C#
C++ vs C#C++ vs C#
C++ vs 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
 
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
 
Vowels walking
Vowels walkingVowels walking
Vowels walking
 
Power point presentation of saminer topic DNA based computing
Power point presentation of saminer topic  DNA based computingPower point presentation of saminer topic  DNA based computing
Power point presentation of saminer topic DNA based computing
 

Ähnlich wie Ppt of c++ vs c#

Ähnlich wie 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
 
Inheritance and its types explained.ppt
Inheritance and its types  explained.pptInheritance and its types  explained.ppt
Inheritance and its types explained.ppt
 

Kürzlich hochgeladen

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Kürzlich hochgeladen (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

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.