1.6.1 Scope Resoln Optr

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

SANJIVANI K. B. P.

POLYTECHNIC, KOPARGAON
With NBA ACCREDIATED programs , Approved by AICTE, New Delhi,
Recognized by Govt. of Maharashtra, Affiliated to Maharashtra State Board of Technical Education, Mumbai,
ISO 9001:2015 Certified Institute

Department:- COMPUTER TECHNOLOGY Class:- SYCM-B

Name of Subject:- Object Oriented Programming Using C++ MSBTE Subject Code:- 22316
Chapter 1: Principles of OOP

1.1) Procedure Vs object oriented programming

1.2) OOP Basic concepts , Languages, Applications of OOP

1.3) C Vs C++, Structure of C++ program, simple C++ program

1.4) Tokens(Keywords, variables, constants) basic data types,


User defined data types, type casting, operators, expressions

Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 2


Chapter 1: Principles of OOP

1.5) Control structures:


Decision making
statements and Loops

1.6) Scope resolution


operator, memory
management operators.

1.7) Arrays, Strings


and structures in c++.

Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 3


POP OOP Procedure Oriented Programming Object Oriented Programming
1)Emphasis More on doing things(procedures) More emphasis is given On data (of object.)
2) Program Large Programs are divided into Programs divided into multiple Objects
divided as multiple functions.
3)DATA TYPE Most of the functions show global Data is hidden from external functions.
data.
4) SUPPORT Doen’t Abstraction, Inheritance, Does Support Abstraction, Inheritance,
Encapsulation and Polymorphism. Encapsulation and Polymorphism.
5) APPROACH Employs Top down Approach Bottom Up
6) DATA Data moves openly around the system Functions operating on Data tied to object in
MOVEMENT from function to function data structure
7) USED IN Example- C, COBOL, PASCAL, FORTRAN Example- C++, JAVA, VB, C#,.Net etc.
8) NEW New functions and data cannot be New functions and data can be easily added
FUNCTIONS easily added whenever required.

9) TALK Functions talk with other by Objects talk each other through functions
exchanging data in diff. forms

01/04/2022 Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 4


OOP: Functions and Data

Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 5


1.2) Basic concepts of OOP
OBJECTS
CLASSES
DATA ABSTRACTION & ENCAPSULATION
INHERITANCE
POLYMORPHISM
DYNAMIC BINDING
MESSAGE PASSING
Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 6
1.3) Simple C++ program
// Simple c++ program that prints string on screen
#include<iostream.h>
#include<conio.h>
int main()
{
cout<<“Have a Nice day students”;
getch();
return 0;
}
Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 7
1.4)
Tokens: basic data types,
Keywords, User defined data types,
variables, type casting,
constants, expressions
operators

Sanjivani K.B.P. Polytechnic, Kopargaon Department


8
of Compute Technology P. M. Dhanrao
1.5) Control structures: Decision making statements and Loops

syntax of
Control
Structures
is
same as
C
Sanjivani K.B.P. Polytechnic, Kopargaon Department of Compute Technology P. M. Dhanrao 9
1.6) Scope resolution operator ::
memory management operators (new delete)

• Scope resolution operator allows to access global version of a variable.


• allows facility to define member variable outside of a class.


Syntax: :: var_name
Exa- cout<<"\nInside main global m = "<<::m;

Double colon :: always refer to global m


Sanjivani K.B.P. Polytechnic, Kopargaon Department
10
of Compute Technology P. M. Dhanrao
1.6.1) Scope resolution operator ::

• int m=10;
• int main()
• { clrscr();
• cout<<"\nIN MAIN GLOBAL m="<<::m;
• int m=20;
• cout<<"\nMAIN FUNCION's m = "<<m;
• {
• int m=30;
• cout<<"\nMAIN INNER BLOCK's { m = "<<m<<" }";
• cout<<"\nMAIN INNER BLOCK { global m = "<<::m;
•}
Sanjivani K.B.P. Polytechnic, Kopargaon Department
11
of Compute Technology P. M. Dhanrao

You might also like