You are on page 1of 18

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 1

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar /* Basic concepts of OOPS */

If you've never used an object-oriented programming language before, you'll need to learn a few basic concepts before you can begin writing any code. This lesson will introduce you to objects, classes, inheritance, interfaces, and packages. Each discussion focuses on how these concepts relate to the real world, while simultaneously providing an introduction to the syntax of the Java programming language.

What Is an Object? An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. This lesson explains how state and behavior are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner.

What Is a Class? A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behavior.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 2

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 3

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

What Is Inheritance? Inheritance provides a powerful and natural mechanism for organizing and structuring your software. This section explains how classes inherit state and behavior from their superclasses, and explains how to derive one class from another using the simple syntax provided by the Java programming language.

What Is an Interface? An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface. This section defines a simple interface and explains the necessary changes for any class that implements it.

What Is a Package? A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage. This section explains why this is useful, and introduces you to the Application Programming Interface (API) provided by the Java platform

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 4

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 5

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar /* Difference between Conventional and OOPS approach */

A major factor in the invention of Object-Oriented approach is to remove some of the flaws encountered with the procedural approach.

Object Orientation Languages (OOL) is concerned to develop an application based on real time while

Procedural Programing Languages (PPL) are more concerned with the processing of procedures and functions.

In OOL, more emphasis is given on data rather than procedures, while the programs are divided into Objects and the data is encapsulated (Hidden) from the external environment, providing more security to data which is not applicable or rather possible in PPL. In PPL, its possible to expose Data and/or variables to the external entities which is STRICTLY restricted IN OOL.

In OOL, the Objects communicate with each other via Functions while there is no communication in PPL rather its simply a passing values to the Arguments to the Functions and / or procedures.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 6

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 7

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar


OOL follows Bottom Up Approach of Program Execution while in PPL its Top Down approach.

OOL concepts includes Inheritance, Encapsulation and Data Abstraction, Late Binding, Polymorphism, Multithreading, and Message Passing while PPL is simply a programming in a traditional way of calling functions and returning values.

OOL language JAVA VB.NET C#.NET

PPL language C VB FORTRAN

Here is the list of OOL languages :- JAVA, VB.NET, C#.NET Here is the list of PPL languages :- C, VB, Perl, Basic, FORTRAN.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 8

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 9

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar /*Difference between C & C++ */

Basic Introduction:

C++ is derived from C Language. It is a Superset of C. Earlier C++ was known as C with classes. In C++, the major change was the addition of classes and a mechanism for inheriting class objects into other classes. Most C Programs can be compiled in C++ compiler. C++ expressions are the same as C expressions. All C operators are valid in C++.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 10

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 11

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar Following are the differences Between C and C++:

C++ 1. C++ is non Procedural i.e Object oriented Language. 2. The concept of virtual Functions are used in C++. 3. The concept of polymorphism is used in C++. Polymorphism is the most Important Feature of OOPS. 4. Operator overloading is one of the greatest Feature of C++. 5. Bottom up approach adopted in Program Design.

1. C is Procedural Language.

2. No virtual Functions are present in C

3. In C, Polymorphism is not possible.

4. Operator overloading is not possible in C. 5. Top down approach is used in Program Design.

6. Namespace Feature is 6. No namespace Feature is present in C present in C++ Language. foravoiding Name collision.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 12

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 13

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

7. Multiple Declaration of global variables are allowed.

7. Multiple Declaration of global varioables are not allowed.

8. In C

8. In C++

scanf() Function used for Input. printf() Function used for output.

Cin>> Function used for Input. Cout<< Function used for output.

9. Mapping between Data and Function is difficult and complicated.

9. Mapping between Data and Function can be used using "Objects" 10. In C++, we cannot call main() Function through other functions. 11. C++ allows the declaration of variable anywhere in the scope i.e at time of its First use. 12. Inheritance is possible in

10. In C, we can call main() Function through other Functions

11. C requires all the variables to be defined at the starting of a scope.

12. No inheritance is possible in C.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 14

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 15

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar


C++. 13. In C, malloc() and calloc() Functions 13.In C++, new and delete are used for MemoryAllocation and operators are used for free() Memory function for memory Deallocating. 14. It supports built-in and primitive data types. 15. In C, Exception Handling is not present. Allocating and Deallocating. 14. It support both built-in and user define data types. 15. In C++, Exception Handling is done with Try and Catch block.

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 16

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 17

Department Of Computer Science & IT Lyallpur Khalsa College, Jalandhar

/*Program to find sum of two noumbers*/ #include<iostream.h> #include<conio.h> void main() { int a,b; clrscr(); cout<<"OUTPUT"; cout<<endl<<endl<<"\tEnter any two no.s: "; cin>>a>>b; cout<<"\tSum of two no.s is: "<<a+b; getch(); }

Teacher sign.

DCS/LKC/BCA-3RD sem/10040/2013-14

page no. 18

You might also like