Object-Oriented Programming

Submitted by: Submitted by

Views: 67

Words: 940

Pages: 4

Category: Science and Technology

Date Submitted: 12/10/2014 03:28 AM

Report This Essay

Write a 700- to 1,050-word paper in which you summarize the relationship between structures, classes, and unions in object- oriented programming.

Discuss the following topics in your paper:

* Structures

* Classes

* Unions

* Inheritance

* Objects

* Polymorphism


Each topic must be discussed from a programmer’s perspective. 
Provide your thoughts on how each may be used. Format your paper consistent with APA guidelines.

Object Oriented Programming (OOP) can be simply thought of as a programming approach where data is modeled and manipulated through the use of objects to develop programs Inheritance, encapsulation, abstraction, and polymorphism are four fundamental concepts in OOP and C++ provides several methods to support OOP.

Structures:

Structures are user defined data types which have a collection of variables of different primitive data types. Structures are often utilized by programmers to describe complex data types. A structure declaration forms a template that may be used to create structure objects (also called instances of a structure). All the variables declared in the structure body are called members, elements or fields. A group of memory locations allocated to the object of structure and each element share the different memory space so the total size of the memory is equal to all the size of all data members of structure.

To declare a structure, we use the keyword “struct” and the general syntax is shown below:

struct structure_name

{

datatype member_varaible1;

datatype member_varaible2;

datatype member_varaiblen;

}structure_variable_name;

An example of a structure template for student information can be declared as follows:

struct student

{

char name[25] ;

int rollno;

int age;

char height;

float percentage;

}

Classes:

Class is a user-defined data type and the most significant OOP facility in C++. We can say a class defines basic structure of objects, and acts as...