Oops concept in AX
Class : Class is the 1st OOPs concept .Class defines the characteristics of objects which includes its attributes , fields properties and behavior . Let us say we have a class called car , then the color , model number , top speed can be its attributes and properties . Accelerating , breaking , turning will be its behavior
Objects: Objects can be considered as a thing that performs a set of related functions .Programming objects are used to model real worlds objects. An object is also an instant of a class . For our class Car , Ferrari will be our object
Instance : One can have an instance of a class; the instance is the actual object created at runtime. The set of values of the attributes of a particular object is called its state. The object consists of state and the behaviour that’s defined in the object’s class.
Method :Also called as functions in some programming languages , methods defines the behavior of particular objects . For our Car class , turning() , breaking () will be our methods .
Inheritance : a parent class can inherit its behavior and state to children classes. This concept was developed to manage generalization and specialization in OOP .Lets say we have a class called Car and Racing Car . Then the attributes like engine no. , color of the Class car can be inherited by the class Racing Car . The class Car will be Parent class , and the class Racing Car will be the derived class or child class
Abstraction : representing only the important details without including all the details . For example the car Ferrari can be treated as simple car only .
Encapsulation: The wrapping up of data and functions into a single unit is called as encapsulation. For example the class car has a method turn () .The code for the turn() defines how the turn will occur . So we don’t need to define how Mercedes will turn and how the Ferrari will turn separately . turn() can be encapsulated with both.
Polymorphism: Its an important OOPs concept , Polymorphism means taking more than one forms .Polymorphism allows the programmer to treat derived class members just like their parent class’s members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to calls of methods of the same name .If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). Each subclass overrides the speak() method inherited from the parent class Animal.
Objects: Objects can be considered as a thing that performs a set of related functions .Programming objects are used to model real worlds objects. An object is also an instant of a class . For our class Car , Ferrari will be our object
Instance : One can have an instance of a class; the instance is the actual object created at runtime. The set of values of the attributes of a particular object is called its state. The object consists of state and the behaviour that’s defined in the object’s class.
Method :Also called as functions in some programming languages , methods defines the behavior of particular objects . For our Car class , turning() , breaking () will be our methods .
Inheritance : a parent class can inherit its behavior and state to children classes. This concept was developed to manage generalization and specialization in OOP .Lets say we have a class called Car and Racing Car . Then the attributes like engine no. , color of the Class car can be inherited by the class Racing Car . The class Car will be Parent class , and the class Racing Car will be the derived class or child class
Abstraction : representing only the important details without including all the details . For example the car Ferrari can be treated as simple car only .
Encapsulation: The wrapping up of data and functions into a single unit is called as encapsulation. For example the class car has a method turn () .The code for the turn() defines how the turn will occur . So we don’t need to define how Mercedes will turn and how the Ferrari will turn separately . turn() can be encapsulated with both.
Polymorphism: Its an important OOPs concept , Polymorphism means taking more than one forms .Polymorphism allows the programmer to treat derived class members just like their parent class’s members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to calls of methods of the same name .If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). Each subclass overrides the speak() method inherited from the parent class Animal.
*******************************************************************************************************************
Basic OOPS Concept for Fresh Developers
OOPs – Object Oriented Programming System
Object-oriented programming (OOP) is a programming paradigm that uses “Objects “and their interactions to design applications and computer programs. There are different types of OOPs are used, they are
1. Object
2. Class
3. Data Abstraction & Encapsulation
4. Inheritance
5. Polymorphism
6. Dynamic Binding
7. Message Passing
1) Object : Object is the basic unit of object-oriented programming. Objects are identified by its unique name. An object 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. An Object is a collection of data members and associated member functions also known as methods. For example whenever a class name is created according to the class an object should be created without creating object can’t able to use class. The class of Dog defines all possible dogs by listing the characteristics and behaviors they can have; the object Lassie is one particular dog, with particular versions of the characteristics. A Dog has fur; Lassie has brown-and-white fur. 2) Class : Classes are data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class. Thus a Class represents a set of individual objects. Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects become functions of the class and is referred to as Methods. For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Colour, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class.No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created. |
3) Data abstraction & Encapsulation :The wrapping up of data and its functions into a single unit is called Encapsulation.
When using Data Encapsulation, data is not accessed directly, it is only accessible through the functions present inside the class.
Data Abstraction increases the power of programming language by creating user defined data types. Data Abstraction also represents the needed information in the program without presenting the details.
Abstraction refers to the act of representing essential features without including the background details or explanation between them.
For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.
4) Inheritance :
Inheritance is the process of forming a new class from an existing class or base class.
Inheritance is the process of forming a new class from an existing class or base class.
The base class is also known as parent class or super class, the new class that is formed is called derived class.
Derived class is also known as a child class or sub class. Inheritance helps in reducing the overall code size of the program, which is an important concept in object-oriented programming.
It is classifieds into different types, they are
· Single level inheritance
· Multi-level inheritance
· Hybrid inheritance
· Hierarchial inheritance
5) Polymorphism :
Polymorphism allows routines to use variables of different types at different times. An operator or function can be given different meanings or functions. Polymorphism refers to a single function or multi-functioning operator performing in different ways.
Polymorphism allows routines to use variables of different types at different times. An operator or function can be given different meanings or functions. Polymorphism refers to a single function or multi-functioning operator performing in different ways.
Poly a Greek term ability to take more than one form. Overloading is one type of Polymorphism. It allows an object to have different meanings, depending on its context. When an exiting operator or function begins to operate on new data type, or class, it is understood to be overloaded.
6) Dynamic binding :
It contains a concept of Inheritance and Polymorphism.
It contains a concept of Inheritance and Polymorphism.
7) Message Passing :
It refers to that establishing communication between one place to another.
It refers to that establishing communication between one place to another.
No comments:
Post a Comment