Stylesheet

Image
import * as React from 'react'; import styles from './Employeespotlight.module.scss'; import { IEmployeespotlightProps } from './IEmployeespotlightProps'; import { escape } from '@microsoft/sp-lodash-subset'; import * as $ from 'jquery'; import { WebPartContext } from '@microsoft/sp-webpart-base'; import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http'; import { SliderHelper } from './Helper'; export interface SpotlightDetails { userDisplayName: string; userEmail: string; userProfilePic: string; description: string; designation?: string; } export interface IStateEmployeeSlider { value:SpotlightDetails[]; } var result=[]; export interface ResponceDetails { title: string; id: string; } export default class Employeespotlight extends React.Component { private defaultProfileImageUrl: string = "/_layouts/15/userphoto.aspx?size=L"; private helper: SliderHelper = new SliderHe...

OOPS - OBJECT ORIENTED PROGRAMMING SYSTEM


Posted by Ganesan - +919042710472

Object oriented programming uses a different set of programming languages than old procedural programming languages. Everything in OOP is grouped as self sustainable "objects". 

Main concepts of OOPs are  Class, Object, Abstraction, encapsulation, inheritance and polymorphism.
CLASS: Class is a collection of objects. Class is composed of three things, a name, attributes, and operations.
To create a class, you simply use the keyword "Class" followed by the Class name,
           Class ClassName
            {
              }
OBJECT:  An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behaviour. For example the hand (object) can grip something. Can give their name or address. an Object is an instance of a class.
           public class student
           {
              }
            srudent objstudent = new student();
According to the above sample we can say that student object, named objstudent, has created out of the class.

ABSTRACTION: Abstraction is a process of hiding the implementation details and displaying the essential features.
For example, laptop is a object that is designed to hide its complexity.

ENCAPSULATION: Encapsulation is a process of binding the data members and member functions into a single unit. encapsulation is like enclosing in a capsule. That is enclosing the related operations and data related to an object into the object.

For example:  

Encapsulation like your bag in which you can keep your pen, book, etc..it means this is the property of encapsulating members and functions.
                              class bag{
                                   book;
                                   pen;
                                   readbook();
                                   }
Encapsulation means hiding the internal details of an object, in other words how an object does something .
Encapsulation prevents clients from seeing its inside view, where the behaviour of the abstraction is implemented.
Encapsulation is technique used to protect the information in an object from another object.
Hide the data for security such as making the variables private, and expose the property to access the private data that will be public. So, when you access the property you can validate the data and set it.
INHERITANCE: Inheritance is a process of deriving the new class from already existing class.
 inheritance is a process of object reusability.
For example:  a child includes the properties of its parents.
       
public class ParentClass {
    public ParentClass() {
        Console.WriteLine("Parent Constructor.");
    }
    public void print() {
        Console.WriteLine("I'm a Parent Class.");
    }
}
public class ChildClass: ParentClass {
    public ChildClass() {
        Console.WriteLine("Child Constructor.");
    }
    public static void Main() {
        ChildClass child = new ChildClass();
        child.print();
    }
}

Output:

Parent Constructor.
Child Constructor.
I'm a Parent Class.

POLYMORPHISM: 

When a message can be processed in different ways is called polymorphism. Polymorphism means many forms.
Polymorphism is one of the fundamental concepts of OOP.
For example: A person behaves the son in the house at the same time that person behaves an employee in an office.
Features of polymorphism: It allows you to invoke methods of derived class. Through base class reference during runtime.
It has the ability for classes to provide different implementations of methods  that are called through the same name.
Types:
1. Compile time polymorphism / overloading
2. Runtime polymorphism /overriding.
Compile time polymorphism: compile time polymorphism is method and operators overloading. Method overloading is the ability to define several methods all with the same name. 
For example: 
        
public class MyLogger
{
    public void LogError(Exception e)
    {
        // Implementation goes here
    }

    public bool LogError(Exception e, string message)
    {
        // Implementation goes here
    }
}

Method overriding: 

Method overriding is a language feature that allows a subclass to override a specific implementation of a method that is already provided by one of its super classes.
A subclass can give its own definition of methods but needs to have the same signature as the method in its super class. This means that when overriding a method the subclass's method has to have the same name and parameter list as the subclass overriden method.


Article by Maria Academy

Comments

Popular posts from this blog

Stylesheet