Showing posts with label OOPS. Show all posts
Showing posts with label OOPS. Show all posts

What is the relation between Classes and Objects

What is the relation between Classes and Objects.Class is a definition, while object is a instance of the class created
What is the relation between Classes and Objects

Class is a definition, while object is a instance of the class created. 
class is like a blueprint/template in OOPs, and this template is used to create objects.The collection of properties & behavior of an object is also called as class.
A class contains  properties, fields, data members, attributes.


Example:

Car is an object , cars is a class
            public class cars
            {
                  //
            }


According to the sample given below we can say that the cars object, named object_car, has created out of the cars class.

               cars object_car = new cars();

object is an instance of a class.An object is an entity that has attributes, behavior, and identity. Objects are members of a class.
Objects are accessed, created or deleted during program run-time.

Declaration of an Object in OOPs
ClassName objectName=new ClassName();
Example:
          Car objCar= new Car();



Attribute in OOPs: Attributes define the characteristics of a class. In Class Program attribute can be a string or it can be a integer. 
Behavior in OOPS:  Every object has behavior.
Identity in OOPS:  Each time an object is created the object identity is been defined.



Bookmark and Share

Advantages of object oriented programming?

Advantages of object oriented programming,Code Re-usability,Code extensibility,Maintainability,Modularity,Modifiability

Advantages of object oriented programming:

  • Code Re-usability(Polymorphism,Interfaces): In OOPs objects created in one program can be reused in different programs.
  • Code extensibility: for addding new features or modifying existing objects can be solved by introducing new objects.
  • Catch errors at compile time rather than at runtime.
  • Maintainability :objects can be maintained separately, so u can easily fix errors.
  • Imrove error handling:We can use exceptions to improve error handling.
  • Modularity: can create seperate Modules.
  • Modifiability:it is easy to make minor changes in some classes as Changes inside a class do not affect any other part of a program.


Bookmark and Share

What is UML?

UML stands for Unified Modeling Language.UML is used to manage large and complex systems

Unified Modeling Language(UML)

UML stands for Unified Modeling Language.UML is used to manage large and complex systems.


With UML you can:
  • Manage project complexity.
  • create database schema.
  • Produce reports.
Types of UML Diagrams:
  1. Class Diagrams
  2. Package Diagrams
  3. Object Diagrams
  4. Use Case Diagrams
  5. Sequence Diagrams
  6. Collaboration Diagrams
  7. State chart Diagrams
  8. Activity Diagrams
  9. Component Diagrams
  10. Deployment Diagrams


Bookmark and Share