OBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES
|
|
- Marvin Chapman
- 6 years ago
- Views:
Transcription
1 Polymorphism: It allows a single name/operator to be associated with different operations depending on the type of data passed to it. An operation may exhibit different behaviors in different instances. Types of Polymorphism 1. Compile time polymorphism 1.1 Function Overloading 1.2 Operator Overloading 2. Run time polymorphism 2.1 Virtual Functions 1. Compile time polymorphism When the Program Compile at the time itself the compiler knows which function should be call to the object. 1.1 Function Overloading: Function Overloading means we can use the same function name and passing different arguments to that function and then perform different operation. return-type function-name 1 (argument list); return-type function-name 2 (argument list); return-type function-name 3 (argument list); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 1
2 Example: // Function Overloading #include <iostream.h> int volume(int); // cube volume int volume(int, int, int); // box volume float volume(int, int); // cylinder volume const float pi = 3.14; int main() cout << "Cube volume : " << volume(5) << "\n"; cout << "Box volume : " << volume(9, 3, 4) << "\n"; cout << "Cylinder volume : " << volume(5, 6) << "\n"; return 0; int volume(int a) return (a*a*a); int volume(int l, int b, int h) return (l * b * h); float volume(int r, int h) return (pi * r * r * h); Output: Cube volume : 125 Box volume : 10 Cylinder volume : 471 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 2
3 OPERATOR OVERLOADING Operator overloading is a way of defining additional task to an existing operator so that it could be applied to user-defined types. An operator's semantic can be extended but its syntax cannot be altered. Overloading is done with the help of a special operator function. Return-type class-name :: operator op(arguments) Operators that cannot be overloaded are. ::?: sizeof.* Friend function cannot be used for operators = () [] -> Types of Operator Overloading: 1. Overloading Unary Operators 2. Overloading Binary Operators 1. Overloading Unary Operators: Unary operator overloaded using member function takes no arguments and return type is void One operant and One operator to be involved and it should be directly communicated to object Operator : -,++,-- returntype classname :: operator op(no arguments) M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 3
4 Example : // Overloading Unary Operators #include<iostream.h> #include<conio.h> class space int x,y,z; public: void getdata() cout<<"enter the values\n"; cin>>x>>y>>z; void display() cout<<x<<" "; cout<<y<<" "; cout<<z<<" "; void operator-() x=-x; y=-y; z=-z; ; void main() clrscr(); space s; s.getdata(); cout<<"s:"; s.display(); -s; cout<<"\ns:"; s.display(); getch(); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 4
5 Output: Enter the values S:1-2 3 S: Overloading Binary Operators: Binary operators overloaded using member function takes a user-defined argument and do return. The left operand is passed implicitly to the operator function and only the right operand is explicitly passed. One operator and two Operant to be involved and it should be directly communicated to object Operator : +, *, / returntype classname :: operator op(one arguments) Example: //Binary Operator Overloading #include<iostream.h> #include<conio.h> class complex float x; float y; public: complex() complex(float real,float imag) x=real; y=imag; M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 5
6 complex operator+(complex c); void display(void); ; complex complex::operator+(complex c) complex temp; temp.x=x+c.x; temp.y=y+c.y; return (temp); void complex :: display(void) cout<<x<<"+j"<<y<<"\n"; void main() complex C1,C2,C3; C1=complex(2.5,3.5); C2=complex(1.6,2.7); C3=C1+C2; clrscr(); cout<<"c1 ="; C1.display(); cout<<"c2 ="; C2.display(); cout<<"c3 ="; C3.display(); getch(); Output: C1=2.5+j3.5 C2=1.6+J2.7 C3=4.1+J6.2 Operator Overloading Rules 1. Only existing operators can be overloaded. 2. The overloaded operator must have at least one operand of user-defined type. 3. Overloaded operators follow the syntax of original operators 4. For unary operators there is no return and for binary operators a class type is returned 5. Operators that cannot be overloaded are. ::?: sizeof.* 6. Friend function cannot be used for operators = () [] -> M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 6
7 2. Run time polymorphism The Compiler do not having any knowledge about which function should be call to object, so it should be decided at the run time itself this known as Run time Polymorphism 2.1 Virtual Function: When the form of a member function is changed at run time that member function is referred to as virtual function. Virtual Function-Name ( ); Example: // Virtual Function #include<iostream.h> #include<conio.h> class base public: void display() cout<<"\n display base"; virtual void show() ; cout<<"\n show base"; //Virtual Function Defined M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 7
8 class derived:public base public: void display() cout<<"\n display derived"; void show() cout<<"\n show derived"; ; void main() base b; derived d; base *bptr; clrscr(); cout<<"\n bptr points to base:"; bptr=&b; bptr->display(); bptr->show(); cout<<"\n bptr points to derived:"; bptr=&d; bptr->display(); bptr->show(); getch(); Output bptr points to base: display base show base bptr points to derived: display base show derived M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 8
Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:
Unit IV Pointers and Polymorphism in C++ Concepts of Pointer: A pointer is a variable that holds a memory address of another variable where a value lives. A pointer is declared using the * operator before
More informationOBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES. Inheritance
Inheritance Definition : Inheritance is the process by which objects of one class acquired the properties of objects of another classes. Inheritance is a property by which the new classes are created using
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Name: Object Oriented Programming
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model answer and the answer written by candidate may
More informationModule Operator Overloading and Type Conversion. Table of Contents
1 Module - 33 Operator Overloading and Type Conversion Table of Contents 1. Introduction 2. Operator Overloading 3. this pointer 4. Overloading Unary Operators 5. Overloading Binary Operators 6. Overloading
More informationOOP THROUGH C++(R16) int *x; float *f; char *c;
What is pointer and how to declare it? Write the features of pointers? A pointer is a memory variable that stores the address of another variable. Pointer can have any name that is legal for other variables,
More informationUNIT II Topics Covered
UNIT II Topics Covered Operator overloading Friend functions Type conversions Templates Inheritance Virtual functions Runtime polymorphism. OPERATOR OVERLOADING POLYMORPHISM Definition: Polymorphism means
More informationOperator overloading. Instructor: Bakhyt Bakiyev
Operator overloading Instructor: Bakhyt Bakiyev content Operator overloading Operator Overloading CONCEPT: C++ allows you to redefine how standard operators work when used with class objects. Approaches
More information2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.
1. Why do you think C++ was not named ++C? C++ is a super set of language C. All the basic features of C are used in C++ in their original form C++ can be described as C+ some additional features. Therefore,
More informationPESIT Bangalore South Campus
USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of ECE INTERNAL ASSESSMENT TEST 2 Date : 03/10/2017 Marks: 40 Subject & Code : Object Oriented Programming
More informationDarshan Institute of Engineering & Technology for Diploma Studies
1. Explain Call by Value vs. Call by Reference Or Write a program to interchange (swap) value of two variables. Call By Value In call by value pass value, when we call the function. And copy this value
More informationCONSTRUCTORS AND DESTRUCTORS
UNIT-II CONSTRUCTORS AND DESTRUCTORS Contents: Constructors Default constructors Parameterized constructors Constructor with dynamic allocation Copy constructor Destructors Operator overloading Overloading
More informationC++ 8. Constructors and Destructors
8. Constructors and Destructors C++ 1. When an instance of a class comes into scope, the function that executed is. a) Destructors b) Constructors c) Inline d) Friend 2. When a class object goes out of
More informationDELHI PUBLIC SCHOOL TAPI
Loops Chapter-1 There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed
More informationLAB MANUAL OBJECT ORIENTED PROGRAMMING LAB (IT- 202 F) (DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING)
LAB MANUAL OBJECT ORIENTED PROGRAMMING LAB (IT- 202 F) (DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING) (Reason behind the object oriented lab) Mission To develop Akido college of Engineering & Technology
More informationDE122/DC106 Object Oriented Programming with C++ DEC 2014
Q.2 a. Distinguish between Procedure-oriented programming and Object- Oriented Programming. Procedure-oriented Programming basically consists of writing a list of instructions for the computer to follow
More informationObject Oriented Programming
F.Y. B.Sc.(IT) : Sem. II Object Oriented Programming Time : 2½ Hrs.] Prelim Question Paper Solution [Marks : 75 Q.1 Attempt the following (any THREE) [15] Q.1(a) Explain encapsulation? [5] (A) The wrapping
More informationUNIT POLYMORPHISM
UNIT 3 ---- POLYMORPHISM CONTENTS 3.1. ADT Conversions 3.2. Overloading 3.3. Overloading Operators 3.4. Unary Operator Overloading 3.5. Binary Operator Overloading 3.6. Function Selection 3.7. Pointer
More informationBRAIN INTERNATIONAL SCHOOL. Term-I Class XI Sub: Computer Science Revision Worksheet
BRAIN INTERNATIONAL SCHOOL Term-I Class XI 2018-19 Sub: Computer Science Revision Worksheet Chapter-1. Computer Overview 1. Which electronic device invention brought revolution in earlier computers? 2.
More informationSolved Exercises from exams: Midterm(1)
Solved Exercises from exams: Midterm(1) 1431-1432 1. What is the output of the following program: #include void fun(int *b) *b = *b+10; main() int a=50; fun(&a); cout
More informationFRIEND FUNCTIONS The syntax for friend function is class ABC { ======= public: ======= friend void function1(void); }
FRIEND FUNCTIONS Anonmemberfunctioncannothaveanaccesstotheprivate dataofaclass. In some situation,two classes like to share a particular function. C++ allows the common function to be made friendly with
More informationC++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different.
C++ Character Set a-z, A-Z, 0-9, and underscore ( _ ) C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. Identifier and Keywords:
More informationAC55/AT55 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2013
Q.2 a. Discuss the fundamental features of the object oriented programming. The fundamentals features of the OOPs are the following: (i) Encapsulation: It is a mechanism that associates the code and data
More informationFunctions. Introduction :
Functions Introduction : To develop a large program effectively, it is divided into smaller pieces or modules called as functions. A function is defined by one or more statements to perform a task. In
More informationOverloading Operators in C++
Overloading Operators in C++ C++ allows the programmer to redefine the function of most built-in operators on a class-by-class basis the operator keyword is used to declare a function that specifies what
More informationSample Paper Class XI Subject Computer Sience UNIT TEST II
Sample Paper Class XI Subject Computer Sience UNIT TEST II (General OOP concept, Getting Started With C++, Data Handling and Programming Paradigm) TIME: 1.30 Hrs Max Marks: 40 ALL QUESTIONS ARE COMPULSURY.
More informationMAHALAKSHMI ENGINEERING COLLEGE B TIRUCHIRAPALLI
MAHALAKSHMI ENGINEERING COLLEGE B TIRUCHIRAPALLI 621213 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Sub code: CS2203 SEM: III Sub Name: Object Oriented Programming Year: II UNIT-I PART-A 1. What is
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate
More informationObject Oriented Pragramming (22316)
Chapter 1 Principles of Object Oriented Programming (14 Marks) Q1. Give Characteristics of object oriented programming? Or Give features of object oriented programming? Ans: 1. Emphasis (focus) is on data
More informationBasic Source Character Set for C++ Language:
Lecture 4 1. Programming in C++ Language: C++ was created by Bjarne Stroustrup, beginning in 1979. The development and refinement of C++ was a major effort, spanning the 1980s and most of the 1990s. Finally,
More informationOBJ. ORI.& MULT. PROG., M.C.Q. BANK, FOR UNIT -2, SECOND YEAR COMP. ENGG. SEM-4, 2012 PATTERN, U.O.P. UNIT-2
UNIT-2 Syllabus for Unit-2 Introduction, Need of operator overloading, overloading the assignment, binary and unary operators, overloading using friends, rules for operator overloading, type conversions
More informationBangalore South Campus
INTERNAL ASSESSMENT TEST 1(Solutions) Date :01/03/2017 Max Marks: 40 Subject& Code: Object Oriented Concepts (15CS45) Sem:VII ISE Name of the faculty: Miss Pragyaa Time: 90 minutes Note: Answer to all
More informationAC55/AT55 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014
Q.2 a. Differentiate between: (i) C and C++ (3) (ii) Insertion and Extraction operator (iii) Polymorphism and Abstraction (iv) Source File and Object File (v) Bitwise and Logical operator Answer: (i) C
More informationFor Teacher's Use Only Q No Total Q No Q No
Student Info Student ID: Center: Exam Date: FINALTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Time: 90 min Marks: 58 For Teacher's Use Only Q No. 1 2 3 4 5 6 7 8 Total Marks Q No. 9
More informationFunction with default arguments
Function with default arguments A function can be called without specifying all its arguments. This can be achieved only if the function declaration provides default values for those arguments that are
More informationExperiment No. 2. Program:
Index 1. C++ program to perform bubble sort. 2. C++ program with class ratio and assign(),convert(),invert(),print() functions. 3. C++ program with circle class using default constructor. 4. C++ program
More informationBHARATHIDASAN ENGINEERING COLLEGE NATTARAMPALLI
BHARATHIDASAN ENGINEERING COLLEGE NATTARAMPALLI-635 854 DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING BONAFIDE CERTIFICATE Certified that this is a bonafide record of the practical word done by
More informationOBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe
OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++
More informationcout<< \n Enter values for a and b... ; cin>>a>>b;
CHAPTER 8 CONSTRUCTORS AND DESTRUCTORS 8.1 Introduction When an instance of a class comes into scope, a special function called the constructor gets executed. The constructor function initializes the class
More informationOverloading operators
Overloading functions Overloading operators In C++ we can have several functions in one program with the same name. The compiler decides which function has to be called depending on the number and type
More informationW3101: Programming Languages C++ Ramana Isukapalli
Lecture-6 Operator overloading Namespaces Standard template library vector List Map Set Casting in C++ Operator Overloading Operator overloading On two objects of the same class, can we perform typical
More informationby Pearson Education, Inc. All Rights Reserved.
Let s improve the bubble sort program of Fig. 6.15 to use two functions bubblesort and swap. Function bubblesort sorts the array. It calls function swap (line 51) to exchange the array elements array[j]
More informationRecharge (int, int, int); //constructor declared void disply();
Constructor and destructors in C++ Constructor Constructor is a special member function of the class which is invoked automatically when new object is created. The purpose of constructor is to initialize
More informationTHE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED.
Constructor and Destructor Member Functions Constructor: - Constructor function gets invoked automatically when an object of a class is constructed (declared). Destructor:- A destructor is a automatically
More informationPage. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team
Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team Question No: 1 ( Marks: 2 ) Write a declaration statement for an array of 10
More informationOverloaded Operators, Functions, and Students
, Functions, and Students Division of Mathematics and Computer Science Maryville College Outline Overloading Symbols 1 Overloading Symbols 2 3 Symbol Overloading Overloading Symbols A symbol is overloaded
More informationKapi ap l S e S hgal P T C p t u er. r S. c S ienc n e A n A k n leshw h ar ar Guj u arat C C h - 8
Chapter 8 Introduction C++ Memory Map Free Stores Declaration and Initialization of pointers Dynamic allocation operators Pointers and Arrays Pointers and Const Pointers and Function Pointer and Structures
More informationCHAPTER 4 FUNCTIONS. 4.1 Introduction
CHAPTER 4 FUNCTIONS 4.1 Introduction Functions are the building blocks of C++ programs. Functions are also the executable segments in a program. The starting point for the execution of a program is main
More informationCS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT
UNIT 1 OBJECT ORIENTED PROGRAMMING FUNDAMENTALS C++ Programming features - Data Abstraction - Encapsulation - class - object - constructors static members constant members member functions pointers references
More informationCS6461- Object Oriented Programming Lab. Manual. IV Semester B.E./EEE Students.
CS6461- Object Oriented Programming Lab Manual IV Semester B.E./EEE Students CS6461-OBJECT ORIENTED PROGRAMMING LABORATORY OBJECTIVES: To get a clear understanding of object-oriented concepts. To understand
More informationAbstraction in C++ Abstraction is the concept of exposing only the required essential characteristics and behavior
Abstraction in C++ Abstraction is the concept of exposing only the required essential characteristics and behavior with respect to a context. Hiding of data is known as data abstraction. In object oriented
More informationSBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION MAX MARKS:70 CODE - A DURATION : 3 Hours
SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION 2016 MAX MARKS:70 CODE - A DURATION : 3 Hours All questions are compulsory. Do not change the order of the questions
More informationChapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer:
Chapter-11 POINTERS Introduction: Pointers are a powerful concept in C++ and have the following advantages. i. It is possible to write efficient programs. ii. Memory is utilized properly. iii. Dynamically
More informationOBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
OBJECT ORIENTED PROGRAMMING Ms. Ajeta Nandal C.R.Polytechnic,Rohtak OBJECT ORIENTED PARADIGM Object 2 Object 1 Data Data Function Function Object 3 Data Function 2 WHAT IS A MODEL? A model is an abstraction
More informationCHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++
CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,
More informationUNIT 1 OBJECT ORIENTED PROGRAMMING FUNDAMENTALS
UNIT 1 OBJECT ORIENTED PROGRAMMING FUNDAMENTALS PART-A 1. Distinguish between methods and messages (APRIL/MAY 2011) Message: Objects communicate by sending messages to each other. A message is sent to
More informationObject-Oriented Design (OOD) and C++
Chapter 2 Object-Oriented Design (OOD) and C++ At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Questions Projects to Assign
More informationKENDRIYA VIDYALAYA SANGATHAN, GUWAHATI REGION HALF-YEARLY EXAMINATION-2015 CLASS XI : COMPUTER SCIENCE Time Allotted : 3 hrs. Max.
KENDRIYA VIDYALAYA SANGATHAN, GUWAHATI REGION HALF-YEARLY EXAMINATION-2015 CLASS XI : COMPUTER SCIENCE Time Allotted : 3 hrs. Max. Marks : 70 Q.1..... operator in C++, requires three operands. [1] Q.2
More informationDownloaded from
Unit I Chapter -1 PROGRAMMING IN C++ Review: C++ covered in C++ Q1. What are the limitations of Procedural Programming? Ans. Limitation of Procedural Programming Paradigm 1. Emphasis on algorithm rather
More informationBVRIT HYDERABAD College of Engineering for Women. Department of Computer Science and Engineering. Course Handout
BVRIT HYDERABAD College of Engineering for Women Department of Computer Science and Engineering Course Handout Subject Name : Data Structures using C++ Prepared by : Mr.U.Chandrasekhar, Associate Professor,
More informationCome and join us at WebLyceum
Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad
More informationSolution: A pointer is a variable that holds the address of another object (data item) rather than a value.
1. What is a pointer? A pointer is a variable that holds the address of another object (data item) rather than a value. 2. What is base address? The address of the nth element can be represented as (a+n-1)
More informationFunction Overloading
Function Overloading C++ supports writing more than one function with the same name but different argument lists. This could include: different data types different number of arguments The advantage is
More informationOOP. Unit:3.3 Inheritance
Unit:3.3 Inheritance Inheritance is like a child inheriting the features of its parents. It is a technique of organizing information in a hierarchical (tree) form. Inheritance allows new classes to be
More informationCSE202-Lec#4. CSE202 C++ Programming
CSE202-Lec#4 Functions and input/output streams @LPU CSE202 C++ Programming Outline Creating User Defined Functions Functions With Default Arguments Inline Functions @LPU CSE202 C++ Programming What is
More informationCS 2203 OBJECT-ORIENTED PROGRAMMING (Common to CSE & IT)
CS 2203 OBJECT-ORIENTED PROGRAMMING 3 0 0 3 (Common to CSE & IT) Aim: To understand the concepts of object-oriented programming and master OOP using C++. UNIT I 9 Object oriented programming concepts objects
More informationcast.c /* Program illustrates the use of a cast to coerce a function argument to be of the correct form. */
cast.c /* Program illustrates the use of a cast to coerce a function argument to be of the correct form. */ #include #include /* The above include is present so that the return type
More informationCOMMON QUARTERLY EXAMINATION SEPTEMBER 2018
i.ne COMMON QUARTERLY EXAMINATION SEPTEMBER 2018 1. a) 12 2. a) Delete 3. b) Insert column 4. d) Ruler 5. a) F2 6. b) Auto fill 7. c) Label 8. c) Master page 9. b) Navigator 10. d) Abstraction 11. d) Void
More informationInheritance: Single level inheritance:
Inheritance: The mechanism of deriving a new class from old one is called inheritance. The old class is referred to as the base class or parent class and the new class is called the derived class or child
More informationDHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING REWRAP TEST I CS6301 PROGRAMMING DATA STRUCTURES II
DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING REWRAP TEST I CS6301 PROGRAMMING DATA STRUCTURES II Year / Semester: III / V Date: 08.7.17 Duration: 45 Mins
More informationPOINTERS - Pointer is a variable that holds a memory address of another variable of same type. - It supports dynamic allocation routines. - It can improve the efficiency of certain routines. C++ Memory
More information6.096 Introduction to C++ January (IAP) 2009
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture
More informationSelection / making decision If statement if-else, if-else-if or nested if Switch Case
SPM 2102 PROGRAMMING LANGUAGE 1 C++ Programming Structure By NORAH MD NOOR 1 Selection / making decision If statement if-else, if-else-if or nested if Switch Case 2 Introduction: Flow of control Normal
More informationKOM3191 Object Oriented Programming Dr Muharrem Mercimek OPERATOR OVERLOADING. KOM3191 Object-Oriented Programming
KOM3191 Object Oriented Programming Dr Muharrem Mercimek 1 OPERATOR OVERLOADING KOM3191 Object-Oriented Programming KOM3191 Object Oriented Programming Dr Muharrem Mercimek 2 Dynamic Memory Management
More informationDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING OBJECT ORIENTED PROGRAMMING CLASS : THIRD SEMESTER CSE
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING OBJECT ORIENTED PROGRAMMING CLASS : THIRD SEMESTER CSE UNIT I 1. State the characteristics of procedure oriented programming. Emphasis is on algorithm. Large
More informationDownloaded from
Unit-II Data Structure Arrays, Stacks, Queues And Linked List Chapter: 06 In Computer Science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.
More information#include <iostream.h> Cout<< enter the number ; Cin>>a>>b; C=a+b; Cout<< sum <<c; getch (); }
UNIT IV: PRINCIPLES OF OBJECT ORIENTED PROGRAMMING Principles of Object Oriented Programming - Beginning with C++ - Tokens-Expressions-control Structures Functions in C++ - classes and objects-constructors
More informationData Structures using OOP C++ Lecture 6
Inheritance Inheritance is the process of creating new classes, called derived classes, from existing or base classes. The derived class inherits all the capabilities of the base class but can add embellishments
More informationUnit III Virtual Functions. Developed By Ms. K.M.Sanghavi
Unit III Virtual Functions Developed By Ms. K.M.Sanghavi Topics Pointers- indirection Operators Memory Management: new and delete : Slide 23-24 / (Covered In Unit I Too) Accessing Arrays using pointers
More informationMAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI
MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI 621213 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Sub code: CS2203 SEM: III Sub Name:Object Oriented Programming Year: II UNIT II Part A 1. Write any
More informationPART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.
Unit - III CHAPTER - 9 INTRODUCTION TO C++ Choose the correct answer. PART I 1. Who developed C++? (a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai 2. What was the original name
More informationObject Oriented Programming. Solved MCQs - Part 2
Object Oriented Programming Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 It is possible to declare as a friend A member function A global function A class All of the above What
More informationLAB MANUAL CS OBJECT ORIENTED PROGRAMMING LAB. Regulation : Year & Semester : II Year / IV Semester
LAB MANUAL Regulation : 2013 Branch : B.E. EEE Year & Semester : II Year / IV Semester CS6461 - OBJECT ORIENTED PROGRAMMING LAB VVIT DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1 ANNA UNIVERSITY: CHENNAI
More informationDepartment of Information Technology Object Oriented Programming. Two Mark Questions
Department of Information Technology Object Oriented Programming Two Mark Questions 1) Give the evolution diagram of OOPS concept. Machine language Procedure language Assembly language OOPS 2) Draw the
More informationOutline. User-dened types Categories. Constructors. Constructors. 4. Classes. Concrete classes. Default constructor. Default constructor
Outline EDAF50 C++ Programming 4. Classes Sven Gestegård Robertz Computer Science, LTH 2018 1 Classes the pointer this const for objects and members Copying objects friend inline 4. Classes 2/1 User-dened
More informationDHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING
DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING Unit I : OVERVIEW PART A (2 Marks) 1. Give some characteristics of procedure-oriented
More informationADTs & Classes. An introduction
ADTs & Classes An introduction Quick review of OOP Object: combination of: data structures (describe object attributes) functions (describe object behaviors) Class: C++ mechanism used to represent an object
More informationCAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE
CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What
More informationUnit-V File operations
Unit-V File operations What is stream? C++ IO are based on streams, which are sequence of bytes flowing in and out of the programs. A C++ stream is a flow of data into or out of a program, such as the
More informationChapter-13 USER DEFINED FUNCTIONS
Chapter-13 USER DEFINED FUNCTIONS Definition: User-defined function is a function defined by the user to solve his/her problem. Such a function can be called (or invoked) from anywhere and any number of
More informationPROGRAMMING IN C++ COURSE CONTENT
PROGRAMMING IN C++ 1 COURSE CONTENT UNIT I PRINCIPLES OF OBJECT ORIENTED PROGRAMMING 2 1.1 Procedure oriented Programming 1.2 Object oriented programming paradigm 1.3 Basic concepts of Object Oriented
More informationCSC 211 Intermediate Programming. Arrays & Pointers
CSC 211 Intermediate Programming Arrays & Pointers 1 Definition An array a consecutive group of memory locations that all have the same name and the same type. To create an array we use a declaration statement.
More informationCLASS-XI COMPUTER SCIENCE
Roll No. Code : 112014-083-A Please check that this question paper contains 7 questions and 8 printed pages. CLASS-XI COMPUTER SCIENCE Time Allowed : 3 Hrs. Maximum Marks : 70 General Instructions : All
More informationWhat is Class? Remember
What is Class? The mechanism that allows you to combine data and the function in a single unit is called a class. Once a class is defined, you can declare variables of that type. A class variable is called
More informationKapil Sehgal PGT Computer. Science Ankleshwar Gujarat Chapter 6 Inheritance Extending a Class
Chapter 6 Inheritance Extending a Class Introduction; Need for Inheritance; Different form of Inheritance; Derived and Base Classes; Inheritance and Access control; Multiple Inheritance Revisited; Multilevel
More informationSome important concept in oops are 1) Classes 2) Objects 3) Data abstraction & Encapsulation. 4) Inheritance 5) Dynamic binding. 6) Message passing
Classes and Objects Some important concept in oops are 1) Classes 2) Objects 3) Data abstraction & Encapsulation. 4) Inheritance 5) Dynamic binding. 6) Message passing Classes i)theentiresetofdataandcodeofanobjectcanbemadeauserdefineddatatypewiththehelpofaclass.
More informationWhat is Pointer? Pointer is a variable that holds a memory address, usually location of another variable.
CHAPTER 08 POINTERS What is Pointer? Pointer is a variable that holds a memory address, usually location of another variable. The Pointers are one of the C++ s most useful and powerful features. How Pointers
More informationThe Address-of Operator &: The & operator can find address occupied by a variable. If var is a variable then, &vargives the address of that variable.
VIRTUAL FUNCITONS Pointers: Some C++ tasks are performed more easily with pointers, and other C++ tasks, such as dynamic memory allocation, cannot be performed without them. As you know every variable
More informationI Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.
I Internal Examination Sept. 2018 Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. [I]Very short answer questions (Max 40 words). (5 * 2 = 10) 1. What is
More informationAn Introduction to C++
An Introduction to C++ The workers and professionals of the world will soon be divided into two distinct groups: those who will control computers and those who will be controlled by the computers. It would
More information