SlideShare a Scribd company logo
1 of 27
Download to read offline
Oops concept on c#
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Week Target Achieved
1 50 19
2 50 22
3 50
Typing Speed
Jobs Applied
# Company Designation Applied Date Current Status
1
2
3
Oops Concept in C#
Nabeel
nabilmohad@gmail.com
nabilmohad
nabilmohad
nabilmohad
9746477551
POP OOP
In POP, program is divided into small parts
called functions.
In OOP, program is divided into parts
called objects.
POP does not have any proper way for
hiding data so it is less secure.
OOP provides Data Hiding so
provides more security.
Example of POP are : C, VB, FORTRAN,
Pascal.
Example of OOP are : C++, JAVA, VB.NET,
C#.NET.
Oops Concept in C#
• Object Oriented Programming
language(OOPS):-
It is a methodology to write the program
where we specify the code in form of classes
and objects.
Class
• Class is a user defined data type. it is like a
template. In c# variable are termed as instances
of classes. which are the actual objects.
Class classname
{
variable declaration;
Method declaration;
}
Object
• Object is run time entity which has different attribute to identify it
uniquely.
Rectangle rect1=new rectangle();
Rectangle rect1=new rectangle();
Here variable 'rect1' & rect2 is object of the rectangle class.
The Method Rectangle() is the default constructor of the class. we
can create any number of objects of Rectangle class.
Basic Concept of oops:-
• There are main three core principles of any
object oriented languages.
• INHERITANCE
• POLYMORPHISM
• ENCAPSULATION
INHERITANCE:-
• One class can include the feature of another
class by using the concept of inheritance.In c#
a class can be inherit only from one class at a
time.Whenever we create class
that automatic inherit from System.Object
class,till the time the class is not inherited
from any other class.
• class BaseClass
• {
• //Method to find sum of give 2 numbers
• public int FindSum(int x, int y)
• {
• return (x + y);
• }
• //method to print given 2 numbers
• //When declared protected , can be accessed only from inside the derived class
• //cannot access with the instance of derived class
• protected void Print(int x, int y)
• {
• Console.WriteLine("First Number: " + x);
• Console.WriteLine("Second Number: " + y);
• }
• }
• class Derivedclass : BaseClass
• {
• public void Print3numbers(int x, int y, int z)
• {
• Print(x, y); //We can directly call baseclass
members
• Console.WriteLine("Third Number: " + z);
• }
• }
• class Program
• {
• static void Main(string[] args)
• {
• //Create instance for derived class, so that base class members
• // can also be accessed
• //This is possible because derivedclass is inheriting base class
• Derivedclass instance = new Derivedclass();
• instance.Print3numbers(30, 40, 50); //Derived class internally calls base class method.
• int sum = instance.FindSum(30, 40); //calling base class method with derived class instance
• Console.WriteLine("Sum : " + sum);
• Console.Read();
• }
•
• }
• Output:-
• First number:30
• Second number:40
• Third number:50
• Sum:70
ENCAPSULATION:-
• Encapsulation is defined 'as the process of enclosing one or more
items within a physical or logical package'. Encapsulation, in object
oriented programming methodology, prevents access to
implementation details.
• Abstraction and encapsulation are related features in object
oriented programming. Abstraction allows making relevant
information visible and encapsulation enables a programmer
to implement the desired level of abstraction.
• Encapsulation is implemented by using access specifiers. An access
specifier defines the scope and visibility of a class member. C#
supports the following access specifiers:
• Public
• Private
• Protected
POLYMORPHISM:-
• It is also concept of oops. It is ability to take more than
one form. An operation may exhibit
different behaviour in different
situations.
• C# gives us polymorphism through inheritance.
Inheritance-based polymorphism allows us to define
methods in a base class and override them with
derived class implementations
• You can have multiple definitions for the same function
name in the same scope. The definition of the function
must differ from each other by the types and/or the
number of arguments in the argument list.
Function Overloading
• class Printdata
• {
• void print(int i)
• {
• Console.WriteLine("Printing int: {0}", i);
• }
• void print(double f)
• {
• Console.WriteLine("Printing float: {0}", f);
• }
• void print(string s)
• {
• Console.WriteLine("Printing string: {0}", s);
• }
• static void Main(string[] args)
• {
• Printdata p = new Printdata();
• // Call print to print integer
• p.print(5);
• // Call print to print float
• p.print(500.263);
• // Call print to print string
• p.print("Hello C++");
• Console.ReadKey();
• }
• }
• Output:-
• Printing int: 5
• Printing float: 500.263
• Printing string: Hello C++
Override
• class Color
• {
• public virtual void Fill()
• {
• Console.WriteLine("Fill me up with color");
• }
• public void Fill(string s)
• {
• Console.WriteLine("Fill me up with {0}", s);
• }
• }
• class Green : Color
• {
• public override void Fill()
• {
• Console.WriteLine("Fill me up with green");
• }
• }
• class nab
• {
• static void Main()
• {
• Green c1 = new Green();
• c1.Fill();
• c1.Fill("red");
• Console.Read();
• }
•
• }
• Out put:
• Fillup with Green
• Fillup with Red
Dynamic Polymorphism
• C# allows you to create abstract classes that are used
to provide partial class implementation of an interface.
Implementation is completed when a derived class
inherits from it. Abstract classes contain abstract
methods which are implemented by the derived class.
The derived classes have more specialized
functionality.
• Please note the following rules about abstract classes:
• You cannot create an instance of an abstract class
• You cannot declare an abstract method outside an
abstract class
• When a class is declared sealed, it cannot be inherited,
abstract classes cannot be declared sealed.
• abstract class Shape
• {
•
• public abstract int area();
•
• }
• class Rectangle: Shape
• {
• private int length;
• private int width;
• public Rectangle( int a, int b)
• {
• length = a;
• width = b;
• }
• public override int area ()
• {
• Console.WriteLine("Rectangle class area :");
• return (width * length);
• }
• }
• class RectangleTester
• {
• static void Main(string[] args)
• {
• Rectangle r = new Rectangle(10, 7);
• double a = r.area();
• Console.WriteLine("Area: {0}",a);
• Console.ReadKey();
• }
• }
• Out put:
• Rectangle class area :
• Area:70
Abstract Classes and Class Members
• The purpose of an abstract class is to provide a
common definition of a base class that multiple
derived classes can share. For example, a class library
may define an abstract class that is used as a
parameter to many of its functions, and require
programmers using that library to provide their own
implementation of the class by creating a derived class.
• Abstract classes may also define abstract methods. This
is accomplished by adding the keyword abstract before
the return type of the method. For example:
sealed
• When applied to a class, the sealed modifier
prevents other classes from inheriting from it.
• When you define new methods or properties
in a class, you can prevent deriving classes
from overriding them by not declaring them
as virtual.
Oops concept on c#
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

What's hot

Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#Adeel Rasheed
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .NetGreg Sohl
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methodsShubham Dwivedi
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in JavaSpotle.ai
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
Properties and indexers in C#
Properties and indexers in C#Properties and indexers in C#
Properties and indexers in C#Hemant Chetwani
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vineeta Garg
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class libraryPrem Kumar Badri
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaRahulAnanda1
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp PresentationVishwa Mohan
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handlingkamal kotecha
 

What's hot (20)

Applets in java
Applets in javaApplets in java
Applets in java
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
Properties and indexers in C#
Properties and indexers in C#Properties and indexers in C#
Properties and indexers in C#
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
 
OOP java
OOP javaOOP java
OOP java
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp Presentation
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
interface in c#
interface in c#interface in c#
interface in c#
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Applets
AppletsApplets
Applets
 

Viewers also liked

Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programmingNeelesh Shukla
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programmingSachin Sharma
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial Jm Ramos
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingMoutaz Haddara
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# IntroductionSiraj Memon
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental PrinciplesIntro C# Book
 
ROI sofort - Enterprise 2.0 auf Basis von Lotus Notes und Domino
ROI sofort -  Enterprise 2.0 auf Basis von Lotus Notes und DominoROI sofort -  Enterprise 2.0 auf Basis von Lotus Notes und Domino
ROI sofort - Enterprise 2.0 auf Basis von Lotus Notes und DominoThomas Bahn
 
Simply - OOP - Simply
Simply - OOP - SimplySimply - OOP - Simply
Simply - OOP - SimplyThomas Bahn
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaGlenn Guden
 
Object oriented programming by Waqas
Object oriented programming by WaqasObject oriented programming by Waqas
Object oriented programming by WaqasWaqas !!!!
 
Project object explain your choice
Project object   explain your choiceProject object   explain your choice
Project object explain your choiceSoren
 
Windows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarchWindows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarchDhananjay Kumar
 
Basic powershell scripts
Basic powershell scriptsBasic powershell scripts
Basic powershell scriptsMOHD TAHIR
 
Inline function(oops)
Inline function(oops)Inline function(oops)
Inline function(oops)Jay Patel
 

Viewers also liked (20)

OOP with C#
OOP with C#OOP with C#
OOP with C#
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
C# basics
 C# basics C# basics
C# basics
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 
ROI sofort - Enterprise 2.0 auf Basis von Lotus Notes und Domino
ROI sofort -  Enterprise 2.0 auf Basis von Lotus Notes und DominoROI sofort -  Enterprise 2.0 auf Basis von Lotus Notes und Domino
ROI sofort - Enterprise 2.0 auf Basis von Lotus Notes und Domino
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Simply - OOP - Simply
Simply - OOP - SimplySimply - OOP - Simply
Simply - OOP - Simply
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using Java
 
Object oriented programming by Waqas
Object oriented programming by WaqasObject oriented programming by Waqas
Object oriented programming by Waqas
 
Project object explain your choice
Project object   explain your choiceProject object   explain your choice
Project object explain your choice
 
Windows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarchWindows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarch
 
Basic powershell scripts
Basic powershell scriptsBasic powershell scripts
Basic powershell scripts
 
Inline function(oops)
Inline function(oops)Inline function(oops)
Inline function(oops)
 
C# String
C# StringC# String
C# String
 

Similar to Oops concept on c#

Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application DevelopmentDhaval Kaneria
 
introduction to c #
introduction to c #introduction to c #
introduction to c #Sireesh K
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rdConnex
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++jehan1987
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)Jay Patel
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxShaownRoy1
 
Learning C++ - Class 4
Learning C++ - Class 4Learning C++ - Class 4
Learning C++ - Class 4Ali Aminian
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introductionSireesh K
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective cSunny Shaikh
 
Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)geetika goyal
 
C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)Umar Farooq
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.Tarunsingh198
 
UNIT-IV WT web technology for 1st year cs
UNIT-IV WT web technology for 1st year csUNIT-IV WT web technology for 1st year cs
UNIT-IV WT web technology for 1st year csjaved75
 
Lecture 13, 14 & 15 c# cmd let programming and scripting
Lecture 13, 14 & 15   c# cmd let programming and scriptingLecture 13, 14 & 15   c# cmd let programming and scripting
Lecture 13, 14 & 15 c# cmd let programming and scriptingWiliam Ferraciolli
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsakreyi
 

Similar to Oops concept on c# (20)

Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 
introduction to c #
introduction to c #introduction to c #
introduction to c #
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
Constructor
ConstructorConstructor
Constructor
 
C#2
C#2C#2
C#2
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 
Python_Unit_2 OOPS.pptx
Python_Unit_2  OOPS.pptxPython_Unit_2  OOPS.pptx
Python_Unit_2 OOPS.pptx
 
Learning C++ - Class 4
Learning C++ - Class 4Learning C++ - Class 4
Learning C++ - Class 4
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
c++ Unit I.pptx
c++ Unit I.pptxc++ Unit I.pptx
c++ Unit I.pptx
 
Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)
 
C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 
UNIT-IV WT web technology for 1st year cs
UNIT-IV WT web technology for 1st year csUNIT-IV WT web technology for 1st year cs
UNIT-IV WT web technology for 1st year cs
 
Lecture 13, 14 & 15 c# cmd let programming and scripting
Lecture 13, 14 & 15   c# cmd let programming and scriptingLecture 13, 14 & 15   c# cmd let programming and scripting
Lecture 13, 14 & 15 c# cmd let programming and scripting
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 

More from baabtra.com - No. 1 supplier of quality freshers

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 
Baabtra soft skills
Baabtra soft skillsBaabtra soft skills
Baabtra soft skills
 

Recently uploaded

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
 
10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdf10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdfJayanti Pande
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINTARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINTDR. SNEHA NAIR
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptxraviapr7
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSyedNadeemGillANi
 
Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....Riddhi Kevadiya
 
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 Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxvidhisharma994099
 
Work Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sashaWork Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sashasashalaycock03
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 
Department of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdfDepartment of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdfMohonDas
 
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
 
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
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeCeline George
 
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
 

Recently uploaded (20)

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
 
10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdf10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdf
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINTARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
 
Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....
 
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 Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptx
 
Work Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sashaWork Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sasha
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 
Department of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdfDepartment of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdf
 
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
 
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
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using Code
 
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...
 

Oops concept on c#

  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. Week Target Achieved 1 50 19 2 50 22 3 50 Typing Speed
  • 4. Jobs Applied # Company Designation Applied Date Current Status 1 2 3
  • 5. Oops Concept in C# Nabeel nabilmohad@gmail.com nabilmohad nabilmohad nabilmohad 9746477551
  • 6. POP OOP In POP, program is divided into small parts called functions. In OOP, program is divided into parts called objects. POP does not have any proper way for hiding data so it is less secure. OOP provides Data Hiding so provides more security. Example of POP are : C, VB, FORTRAN, Pascal. Example of OOP are : C++, JAVA, VB.NET, C#.NET.
  • 7. Oops Concept in C# • Object Oriented Programming language(OOPS):- It is a methodology to write the program where we specify the code in form of classes and objects.
  • 8. Class • Class is a user defined data type. it is like a template. In c# variable are termed as instances of classes. which are the actual objects. Class classname { variable declaration; Method declaration; }
  • 9. Object • Object is run time entity which has different attribute to identify it uniquely. Rectangle rect1=new rectangle(); Rectangle rect1=new rectangle(); Here variable 'rect1' & rect2 is object of the rectangle class. The Method Rectangle() is the default constructor of the class. we can create any number of objects of Rectangle class.
  • 10. Basic Concept of oops:- • There are main three core principles of any object oriented languages. • INHERITANCE • POLYMORPHISM • ENCAPSULATION
  • 11. INHERITANCE:- • One class can include the feature of another class by using the concept of inheritance.In c# a class can be inherit only from one class at a time.Whenever we create class that automatic inherit from System.Object class,till the time the class is not inherited from any other class.
  • 12. • class BaseClass • { • //Method to find sum of give 2 numbers • public int FindSum(int x, int y) • { • return (x + y); • } • //method to print given 2 numbers • //When declared protected , can be accessed only from inside the derived class • //cannot access with the instance of derived class • protected void Print(int x, int y) • { • Console.WriteLine("First Number: " + x); • Console.WriteLine("Second Number: " + y); • } • }
  • 13. • class Derivedclass : BaseClass • { • public void Print3numbers(int x, int y, int z) • { • Print(x, y); //We can directly call baseclass members • Console.WriteLine("Third Number: " + z); • } • }
  • 14. • class Program • { • static void Main(string[] args) • { • //Create instance for derived class, so that base class members • // can also be accessed • //This is possible because derivedclass is inheriting base class • Derivedclass instance = new Derivedclass(); • instance.Print3numbers(30, 40, 50); //Derived class internally calls base class method. • int sum = instance.FindSum(30, 40); //calling base class method with derived class instance • Console.WriteLine("Sum : " + sum); • Console.Read(); • } • • }
  • 15. • Output:- • First number:30 • Second number:40 • Third number:50 • Sum:70
  • 16. ENCAPSULATION:- • Encapsulation is defined 'as the process of enclosing one or more items within a physical or logical package'. Encapsulation, in object oriented programming methodology, prevents access to implementation details. • Abstraction and encapsulation are related features in object oriented programming. Abstraction allows making relevant information visible and encapsulation enables a programmer to implement the desired level of abstraction. • Encapsulation is implemented by using access specifiers. An access specifier defines the scope and visibility of a class member. C# supports the following access specifiers: • Public • Private • Protected
  • 17. POLYMORPHISM:- • It is also concept of oops. It is ability to take more than one form. An operation may exhibit different behaviour in different situations. • C# gives us polymorphism through inheritance. Inheritance-based polymorphism allows us to define methods in a base class and override them with derived class implementations • You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list.
  • 18. Function Overloading • class Printdata • { • void print(int i) • { • Console.WriteLine("Printing int: {0}", i); • } • void print(double f) • { • Console.WriteLine("Printing float: {0}", f); • } • void print(string s) • { • Console.WriteLine("Printing string: {0}", s); • } • static void Main(string[] args) • { • Printdata p = new Printdata(); • // Call print to print integer • p.print(5); • // Call print to print float • p.print(500.263); • // Call print to print string • p.print("Hello C++"); • Console.ReadKey(); • } • }
  • 19. • Output:- • Printing int: 5 • Printing float: 500.263 • Printing string: Hello C++
  • 20. Override • class Color • { • public virtual void Fill() • { • Console.WriteLine("Fill me up with color"); • } • public void Fill(string s) • { • Console.WriteLine("Fill me up with {0}", s); • } • } • class Green : Color • { • public override void Fill() • { • Console.WriteLine("Fill me up with green"); • } • } • class nab • { • static void Main() • { • Green c1 = new Green(); • c1.Fill(); • c1.Fill("red"); • Console.Read(); • } • • } • Out put: • Fillup with Green • Fillup with Red
  • 21. Dynamic Polymorphism • C# allows you to create abstract classes that are used to provide partial class implementation of an interface. Implementation is completed when a derived class inherits from it. Abstract classes contain abstract methods which are implemented by the derived class. The derived classes have more specialized functionality. • Please note the following rules about abstract classes: • You cannot create an instance of an abstract class • You cannot declare an abstract method outside an abstract class • When a class is declared sealed, it cannot be inherited, abstract classes cannot be declared sealed.
  • 22. • abstract class Shape • { • • public abstract int area(); • • } • class Rectangle: Shape • { • private int length; • private int width; • public Rectangle( int a, int b) • { • length = a; • width = b; • } • public override int area () • { • Console.WriteLine("Rectangle class area :"); • return (width * length); • } • } • class RectangleTester • { • static void Main(string[] args) • { • Rectangle r = new Rectangle(10, 7); • double a = r.area(); • Console.WriteLine("Area: {0}",a); • Console.ReadKey(); • } • } • Out put: • Rectangle class area : • Area:70
  • 23. Abstract Classes and Class Members • The purpose of an abstract class is to provide a common definition of a base class that multiple derived classes can share. For example, a class library may define an abstract class that is used as a parameter to many of its functions, and require programmers using that library to provide their own implementation of the class by creating a derived class. • Abstract classes may also define abstract methods. This is accomplished by adding the keyword abstract before the return type of the method. For example:
  • 24. sealed • When applied to a class, the sealed modifier prevents other classes from inheriting from it. • When you define new methods or properties in a class, you can prevent deriving classes from overriding them by not declaring them as virtual.
  • 26. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 27. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com