You are on page 1of 24

Assignment title: FEATURES AND DIFFRENCES B/W

CLASS, OBJECT AND STRUCTURES

Course title: OBJECT-ORIENTED PROGRAMMINNG

Course code: IT-201


Class: MSC-IT 2ND SMESTER

Submitted by: AROOJ ARIF


Roll no: 20010856-014
Submitted to: RESPECTED SIR ADEEL
Submission date: 03 JUNE 2021

DEPARTMENT OF INFORMATION TECHNOLOGY,


GOVT.UNIVERSTY OF GUJRAT
 ABSTRACT:

In this assignment we will discuss about difference between structure and object oriented
program. the main difference is that between these terms the structure programming is a software
development method that uses modularization and structured design. And object-based
application is an application that involves objects created out of classes. We also discuss A class
has all members private by default. And struct is a class where members are public by default.
We will know about features of OOP like object, class, abstraction, Inheritance etc.
 Table of contents:

 Difference between structured programming and object oriented programming.

 Difference between class and object

 Difference between structures and classes

 Key features of OOP


 Question 01:

Explain the difference between structured programming and object oriented


programming.

Answer:

1. Introduction of object oriented program:


An object-based app is an application that includes objects created outside of categories. These
elements come together to accomplish a specific function. The focus of this project is to develop
an Java-based application that involves the use of an object-oriented program. This project is one
project. As a student you will be given the opportunity to come up with an idea for your project.
However, the project must satisfy the equipment provided in this document. This text will be
used as a guide for guide. You are allowed to make the necessary additions and / or changes to
the requirements with the prior approval of your instructor.

2. Introduction to structured Programming:

It is a software development method that uses modem processing and structured design. this
means that large programs or texts are divided into smaller modules and the modules
individually use structured modules which means that the statements are organized in a way that
minimizes errors and misinterpretations.
Scheduled programming is done in the programming language PHP C # C ++ java visual basic
and python are these languages. It is a programming method that aims to improve the quality,
clarity and access time of a computer program using block formats, subroutines, loops and time.
These planning features will be helpful when the concept of differentiating delivery is required in
the system. It uses a variety of control structures, sub-methods, blocks and theory. Theorems
involved in construction processes are Sequence, Selection, Iteration and Recursion. Most
programming languages use formal language features such as ALGOL, Pascal, PL / I, Ada, C,
etc. The programming force imposes a logical structure in the written system to make it work
easier and easier to modify and understand. What is a programming language that is defined in a
simple and straightforward way To accomplish any task, language C divides the problem into
smaller modules called individual tasks or processes that handle a specific task. That is why C
language is also called formal planning language. A system that solves every problem is the
collection of such tasks. Systematic (SP) is a method used to improve the reliability and clarity
of systems. In SP, system flow control is limited to three layouts, sequences, IF FOLLOWED,
and ACTUALLY, or to a structure derived from a combination of three basic elements.
Therefore, a formal system does not require the use of GO TO or branches (unless it is written in
a language that does not have statement forms corresponding to SP structures, in which case, GO
TO can be used to mimic structures). The result is a system made up of highly independent
modules for each other. Next, this allows the program developer to be more confident that the
code contains fewer logic errors and that it will be easier to fix the error and change it in the
future. However, SP may be less effective than an unstructured partner. Another disadvantage is
the relative difficulty of using SP in unsupported language, even if the situation changes as
languages are updated (e.g., FORTRAN 77).

Differences between structure and Object-oriented Systems

The main difference between Structured Programming and OOP is that the focus of Structured
Programming to plan this program on sub-program managers while, OOP is focused on reducing
program work on things, including data and methods.
OOP is considered more flexible than planned systems, because OOP separates the system from
the network of resources under the planning system in the management category. While the
layout provides some clarity, a small change in a highly structured system can have a major
impact on changing multiple programs.
The Organized OOP program is designed to focus on process / logical process and then the data
required for that process. built to focus on data. way up. way down to the top. known as Modular
Programming and a small collection of programming language

Structured oriented programming language –

 In this type of language, large programs are divided into smaller programs called
activities.
 Main focus on data operations and processes
 Data moves freely around systems from one function to another
 The design of the program follows the “Top Down Approach”
 Example: C, Pascal, ALGOL and Module-2

Object-oriented programming language –

 In this type of language, programs are divided into objects


 The primary focus is on the data used and not on the functions or procedur
 Data is hidden and cannot be accessed for external activities
 The design of the program follows “High Quality”
 Example: C ++, Java and C # (C sharp)

Summary of Differences Between Focused Planning and Systematic Planning:

 The difference between Object-Oriented Programming and Structured Programming is that


structured programs focus on higher programming while object-focused programs destroy
the system into objects.
 Another difference between Object-Oriented Programming and Structured Programming is
that the focus of the object is closer to the real world while the formal system operates with
rational thinking.
 The formal system organizes the system into a management unit but when one of the
systems is changed, the whole structure results in a mess.
 This is not the case with object-focused programs because programs are in their stages.
 The methods refer to the behavior of a class and the class has similarities or elements.
 Both species have different languages.

 Question 02:

Explain the difference between class and object.

What is a class?
A category is a “template” or “plan” used to create things. Describes data and type behavior.
The category allows you to create your own custom styles by collecting a variety of different
styles, styles and events.
The section also supports the main feature of the program aimed at an item eg asset.
The category contains a field, a static field, a path, a vertical path and a builder.
Field: The class field holds the status of a category e.g.
Method: Methods represent the functioning of a category, for example to show how a functional
object works.
Builder: Used to create a new class model.

What is the object?


Basically something is an organization. When we talk about the real things of the world like a
person, cars etc, each of these things has two aspects. For example, a person has
Country: Name and age
Behavior: running, sleeping
If we take the example of a car object, then it also has a shape (speed) and shape (braking).
Similarly, when we discuss objects in programming languages that are directed to an object, each
object has
Features (Attribute or country)
Methods (Do something or take action)
The object retains its shape in the fields and expresses its character in ways.
The memory block object provided and sorted according to plan. A category can do a lot of
things stored in a word-for-word variation or sequence or collection. In object-oriented language
such as C #, a standard system contains a number of compound elements.

The difference

1. Category and objects are the key concepts of Object-Based Process, a class is a plan used
to create objects of the same type while an object is an object.
2. A class is a type while an object is different.
3. Classroom is an expanded concept of data structures and objects are class reinforcement.
4. Section is logical while object is tangible.
5. When a category is announced, no memory is provided but when a category item is
announced, the memory is shared.
6. The category constructs objects and provides state values and ethical implementation
while items contain structures and methods. Elements are symbols of an object while
methods provide functionality.
7. The purpose of objects is to extract data while that category is data collection.
8. A category does not represent something else - rather it represents the knowledge and
manner in which something should be.
1. Requirements:

Suggest and use an app, which contributes to solving a real problem. Your request must
include at least the following:

Classes:

3 to 4 classes each should be:

A. Many private and public qualities. Hidden (variable) attributes will require
compatible setup / acquisition methods.
B. Two or more developers, one of whom at the time should consider all members of
the class data (attributes) as arguments.
C. Other methods that can show the relationship between different classes. For
example, suppose we have a hotel plan, where the cost user can book a room.
Each customer has an (private) ID and name. Each room has a number and a
price. The relationship between the Customer section and the Room section is
documented as shown in the following class diagram:
This relationship should be used on the Customer's side as a means of treating the Room item as
a dispute, so when a customer books a room, the room item will be stored for example in
ArrayList or file in case the customer is allowed to book more than one room.

A. Each section should have a printDetails method that will print user details
B. One main stage (Test) is to create objects without sections in your app, and to show the
connection between these items.

The basic concept of a class:

• A clause is a metaphor that describes the qualities and behaviors of objects or objects.
• A category is a plan or form of organization.
• Phase implementation of unintelligible data type (ADT).
• Describes qualities and methods.

Object declaration:
• In the following example a class activity is created and an 'a' is an element of this category.
object of class
{
// member data and member functions
} a;

• In the name of the syntax category above it is an object, and it belongs to that category
• The announcement of the item can also be made to the main function () as follows:

int main ()
{
into a;
}
Finding a category member:
o Independent class members may only be reached by members of that class.
o Class community members can be reached outside the classroom as well.
o Access to a member of a category outside the category can be done using a dot
operator and object for that grade using the following syntax,

word-object-active word (real arguments);


• The duties of class members may be announced without class and subsequent description,

Syntax:

object of class
{
community:
empty getdata ();
};
missing item :: getdata ();

Example:

#include <iostream>
using namespace std;

class class // category


{
name char [10]; // data member
id id; // data member
community:
empty getdata (); // show announcement

Accessing class member:


 A clause is a metaphor that describes the qualities and behaviors of objects or objects.
 A category is a plan or form of organization.
 Phase implementation of unintelligible data type (ADT).
 Describes qualities and methods.

Objects:

A. The Main Class (Test) builds at least 3 objects in each class using different builders.
B. After creating objects, show how to read or change the values of the secret symbols.
C. Indicate the connection (relationship) between these creations. For example, if you think
you have created a customer item (cl) and a room item (rl), you can use the manual to
book the cl rl as follows:
books. (rl);
D. Create a demo that shows the details to the user of each created object.

Files and Arrays:

A. When you create an item in the Test section, read the variable object values in the item
from the user (e.g., ID value).
B. After creating things keep them temporary in sequence (ArraList is recommended). Then
save them permanently on file.
C. When you print item details read from that file.

Installation confirmation:

A. Use input confirmation where required, for example, in the example given above, room price
should not be a bad price, or you cannot have two customers with the same ID.
Memory allocation of objects
for example.

• Member functions are performed and placed in the memory space only once they are defined as
part of the class specification.
• There is no separate space allocated to the activities of members when things are created.
• Only member space is allocated separately for each item.
• Different memory location of objects is possible, because member variables will capture
different data values for different objects.

Example:

class item
{
public:
int id, cost;
void getdata();
};
int main()
{
item x,y,z;
}

 In the example above each item x, y and z has a different space for both id
and cost.
 Means id id and cost may vary for each item.
 But there is no default space allocated to work when an item is announced.
 A separate required space is allocated to work at the time of calling the job.
 Question 03:

Explain the difference between class and structure.

Here I will explain you complete difference between Class and Structure -

Class

 Category has all private members automatically.


 A class is a type of reference and its object is built into the memory of the mass.
 The class can inherit another asset.
 The class can have all kinds of builder and destroyer.
 Classes allow cleaning (garbage collector) before the item is delivered
because the garbage collector is working on the bulk memory. Items are
usually delivered when the pattern can no longer be displayed with another
code.
 It takes up a lot of space.
 Classroom diversity can be implemented directly.
 The empty phase of the Sizeof is 1 Byte.
 A class item cannot be done without using a new keyword, it means we must
use it.
 Short obj = new Short ();

Structure:
 The structure is the stage where the members are in public.
 Structure is a type of number which is why its object is built on stack
memory.
 Property does not support inheritance.
 A building can only have a built-in builder. means the building cannot have
a lineless builder, an automatic builder and a destroyer again.
 Structures cannot collect garbage so no memory management is effective.
 The building takes up little space.
 The diversity of members of a structure cannot be initiated directly.
 Empty layout is 0 bytes.
 The build item can be built without using a new keyword. (Optional)
 Demo obj;
In general, it is entirely possible to create roads that look very similar to
classrooms and sections that look like streets.
Question 04:

Explain the key features of OOP.

Features of OOPS:
Object-oriented approaches are popular because many experts agree that Object Oriented
strategies are more targeted than conventional structured methods. (Martin and Odell 1992) The
key elements of Object-based technology are „objects and phases ab, abst data extraction and
encapsulation‟, „inheritance‟ and „polymorphism‟. It is very important for you to understand
these concepts. In addition, in this unit you can find details of these ideas.

A. Object-oriented (OOP) system is a system model in which Systems are organized around
an object and data rather than an action and a concept. OOP allows problem
decompression into multiple objects called Object and creates data around and around
these objects.
B. The system is divided into smaller units called Object. Data and activity are built around
these things.
C. Details of items can only be obtained for activities related to that item.
D. The functions of one object can access the functions of another object.

 OOP has the following important features

. Class:
The section is the context of any modern language for the Object System. In OOP languages a
data representation section should be made. A section is a framework that contains the variables
of data storage and operations. The category will not take up memory space and therefore only
logical representation of data. To create a category, simply use the keyword "class" followed by
a class name:

class Employee
{
}

Object:
Objects are the basics of operating time in an object-focused system.They can represent a person,
a location "Any object or any object of a software-related program flexibility to perform and
manage." "Item is a category instance"

Category will not replace memory. So working with the data represented by a category should
create phase flexibility, which is called something. When an object is created using a new
keyword, the memory will be assigned a category to the bulk memory location, called as an
example and its original address will be stored in the object in the stack memory.

When an object is created without a new keyword, the memory will not be allocated to a bulk I.e.
for example it cannot be constructed and the object in the stack contains an empty value. When
an item contains an item, then it is not possible to reach class members using the item.

class Employee
{
}
Syntax to create an object of class Employee:

Employee objEmp = new Employee();


Similarly, the following can be treated as objects in different programming problems:

 Employees in the pay system


 Customers and accounts in the banking system
 Seller, products, customers in the sales tracking system
 Data structures such as linked lists, stacks, etc.
 Hardware devices such as magnetic tape drive, keyboard, printer etc.
 GUI items such as windows, menus, events, etc. In any window-based application.

All the programming languages supporting object oriented Programming will be supporting
these three main concepts:
1. Encapsulation
2. Inheritance
3. Polymorphism

Abstraction:

Abstraction means putting all the variables and methods needed in the classroom. Example: -
Abstract class and abstract method. Abstraction is a common occurrence. Example: If someone
at your college tells you to fill out an application form, you will fill in your details such as name,
address, birth details, semester, percentage you have. will fill in details such as name, address,
date of birth, blood group, height and weight. See in the example above what is normal? Age,
name, address so you can create a class that contains a common object called an abstract class.
That category is incomplete and may be inherited by another category.

Real-world example of Abstraction:

Let's say you have a Phone Phone.


Suppose you have three cell phones as follows:
Nokia 1400 (Features: - Call, SMS)
Nokia 2700 (Features: - Call, SMS, FM Radio, MP3, Camera)
Black Berry (Features: -Calling, SMS, FM Radio, MP3, camera, video recording, email reading)

Invisible details (Required and General Information) of the "Mobile Phone" item to call any
number and can send an SMS.
"so that in the case of a mobile phone you will have an ambiguous category as follows:

abstract class MobilePhone


{
public void Calling();
public void SendSMS();
}
public class Nokia1400 :
MobilePhone
{
}
public class Nokia2700 :
MobilePhone
{
public void FMRadio();
public void MP3();
public void Camera()
;}
public class BlackBerry : MobilePhone

{
public void FMRadio();
public void MP3();
public void Camera();
public void Recording();
public void ReadAndSendEmails();
}

Abstraction means putting all the variables and methods needed in the classroom. Example: -
Abstract class and abstract method. Abstraction is a common occurrence. Example: If someone
at your college tells you to fill out an application form, you will fill in your details such as name,
address, birth details, semester, percentage you have. will fill in details such as name, address,
date of birth, blood group, height and weight. See in the example above what is normal? Age,
name, address so you can create a class that contains a common object called an abstract class.
That category is incomplete and may be inherited by another category.

Encapsulation:
Wrapping up a data member and how to collaborate on a single unit (e.g. class) is called
Encapsulation. Infusion is like closing a pill. That includes activities related to the data
associated with the object in that object. Encapsulation is like your wallet where you can keep
your pen, book etc. It means that this property is a combination of members and functions.
class Bag

{
book;
pen;
ReadBook();
}

Encapsulation:
means to hide the internal details of an object, eg how an object does something. Encapsulation
prevents clients from seeing their inner view, where the extraction applies. Encapsulation is a
process used to protect information from an object from another object. Hide security data as a
variable to make it private, and expose assets to private information that will be made public.
Therefore, when accessing the property you can verify the data and set it up.

Example:

class Demo
{
private int _mark;
public int Mark
{
Get
{
return _mark;
}
Set
{
if (_mark > 0) _mark = value; else _mark = 0;
}
}
}

A real world example of Encapsulation:

Let's take the example of a Cell Phone and a Mobile Phone Maker Suppose you are a Mobile
Phone Maker and you designed and built the phone (section), now using machines you make a
mobile phone (object) for sale, when you sell a mobile phone the user learns to use a mobile
phone but not how this mobile phone works. This means that you create a class by work and by
making an object (capsule) you make your class work with that object and without interruption
in the first class.

Example 2:
TV Performance Installed and can work remotely and there is no need to turn on the TV and
change the channel. Here everything is private without remote control so anyone can access
inactivity and change the contents of the TV.

Modularity:

Modularity designs a system divided into a set of functional units (named modules) that can be
integrated with a larger program.

Inheritance:

Inheritance is the process of building new classes (based class) from an existing Class (base
class). The most important asset benefit is reusing the code.

Polymorphism:

Polymorphism is the ability of a message or function to be expressed in more than one way.
 Conclusions:

By this assignment we are able about to understand about all differences between structure
programming, object oriented programming, class, object and structure. We also study key
features of OOP.

You might also like