C# Fundamentals - Basics of OOPS - PowerPoint PPT Presentation

About This Presentation
Title:

C# Fundamentals - Basics of OOPS

Description:

Programming language model organized around objects rather than "actions" and data rather than “logic”. For a programming language to be a true OOP language, the language must meet the following criteria: abstraction, encapsulation, polymorphism, inheritance – PowerPoint PPT presentation

Number of Views:2584
Slides: 18
Provided by: ifourtechnolab
Category: Other

less

Transcript and Presenter's Notes

Title: C# Fundamentals - Basics of OOPS


1
iFour Consultancy
https//www.ifourtechnolab.com/microsoft-technolog
y
2
Definition
  • A markup language is a set of markup tags
  • A markup language is a set of markup tags
  • Programming language model organized around
    objects rather than "actions" and data rather
    than logic. Historically, a program has been
    viewed as a logical procedure that takes input
    data, processes it, and produces output data
  • For a programming language to be a true OOP
    language, the language must meet the following
    criteria
  • Abstraction
  • Encapsulation
  • Polymorphism
  • Inheritance

https//www.ifourtechnolab.com/microsoft-technolog
y
3
Fundamentals
  • Classes and Objects
  • The terms class and object are sometimes used
    interchangeably, but in fact, classes describe
    the type of objects, while objects are usable
    instances of classes. So, the act of creating an
    object is called instantiation. Using the
    blueprint analogy, a class is a blueprint, and an
    object is a building made from that blueprint
  • Abstraction
  • Abstraction manages the complexities of a
    business problem by allowing you to identify a
    set of objects involved with that business
    problem
  • Encapsulation
  • Encapsulation hides the internal implementation
    of an abstraction within the particular object
  • Polymorphism
  • It provides for multiple implementations of the
    same method. For example, different objects can
    have a Save method, each of which perform
    different processing
  • Inheritance
  • The excitement of Visual Basic .NET lies in
    inheritance. Visual Basic 5 introduced the
    concept of interface inheritance, which allows
    you to reuse the interface of a class, but not
    its implementation

https//www.ifourtechnolab.com/microsoft-technolog
y
4
What is a class?
  • It can be defined as a template/blueprint that
    describes the behaviors/states that object of its
    type support
  • Example of simple class with member properties
    and member methods.
  • public class Circle
  • private decimal _radius
  • public double radius getreturn _radius
    set_radius values
  • public double Area()
  • return 3.141592 _radius _radius

https//www.ifourtechnolab.com/microsoft-technolog
y
5
What is Object?
  • It represents a particular instance of a class.
    There can be more than one instance of an object.
    Each instance of an object can hold its own
    relevant data
  • Example of Simple instantiate of an object of the
    class in the example of previous slides
  • Circle objCircle new Circle() //here
    objCircle is an instance of a class
  • Circle objCir new Circle() //here objCir is
    an instance of a class
  • Both the instantiation(Objects) holds the related
    data and members of the class and can be used for
    different purposes

https//www.ifourtechnolab.com/microsoft-technolog
y
6
Abstraction
  • Example
  • Real world example Laptop
  • When derived class inherited with abstract class
    derived class must be override abstract class
    methods

https//www.ifourtechnolab.com/microsoft-technolog
y
7
Encapsulation
  • Hiding irrelevant data from the user
  • A class may contain much information that is not
    useful for an outside class or interface
  • So classes use encapsulation to hide its members
    that are not relevant for an outside class or
    interface
  • It can be done using access specifiers
  • In the same example of Circle class Private is
    a specifier used for Member variable. So It hides
    the data to be used outside the class
  • private decimal _radius

https//www.ifourtechnolab.com/microsoft-technolog
y
8
Inheritance
  • Use in the small, when a derived class "is-a"
    base class
  • enables code reuse
  • enables design reuse polymorphic programming
  • Example
  • a Student is-a Person

https//www.ifourtechnolab.com/microsoft-technolog
y
9
Inherited Methods
https//www.ifourtechnolab.com/microsoft-technolog
y
10
Inherited Methods
https//www.ifourtechnolab.com/microsoft-technolog
y
11
Polymorphism
  • Static polymorphism
  • Function overloading
  • Operator overloading
  • Dynamic Polymorphism
  • abstract classes
  • virtual functions

https//www.ifourtechnolab.com/microsoft-technolog
y
12
Virtual and Overridden Methods
https//www.ifourtechnolab.com/microsoft-technolog
y
13
Combining Method Overriding and Hiding
https//www.ifourtechnolab.com/microsoft-technolog
y
14
Procedure v/s Object Oriented Programming
  • It is a methodology to write the program where we
    specify the code in form of classes and objects
  • Object-oriented programming is the successor of
    procedural (structural) programming
  • Procedural programming describes programs as
    groups of reusable code units (procedures) which
    define input and output parameters. Procedural
    programs consist of procedures, which invoke each
    other
  • The problem with procedural programming is that
    code reusability is hard and limited only
    procedures can be reused and it is hard to make
    them generic and flexible.
  • There is no easy way to work with abstract data
    structures with different implementations
  • This is how objects came to be. They describe
    characteristics (properties) and behaviour
    (methods) of such real life entities

https//www.ifourtechnolab.com/microsoft-technolog
y
15
Interface
  • Multiple Inheritance Support
  • Example
  • SmartPhone
  • OS()
  • AppStore()

https//www.ifourtechnolab.com/microsoft-technolog
y
16
References
  • https//www.tutorialspoint.com/csharp/
  • http//www.c-sharpcorner.com/UploadFile/mkagrahar
    i/introduction-to-object-oriented-programming-conc
    epts-in-C-Sharp/

https//www.ifourtechnolab.com/microsoft-technolog
y
17
  • Thank You..

https//www.ifourtechnolab.com/microsoft-technolog
y
Write a Comment
User Comments (0)
About PowerShow.com