OBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES. Inheritance
|
|
- Madlyn Robbins
- 6 years ago
- Views:
Transcription
1 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 the old classes. In other words the new classes can be developed using some of the properties of old classes Base Class : Definition: The old class is referred to as the Base class A class from which other classes are derived. A derived class can inherit members from a base class Syntax: Class Class-name Example: class B int a; void get_a(); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 1
2 Derived Class: Definition: A Class that inherits some or all of its members from another class (Base class) is called as Derived Class Syntax: Class Derived-Class-name : Visibility-Mode Base-Class-Name Example: class D:public B int b; void get_b(); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 2
3 Access Specifier (Visibility Mode) : The access specifier such as Public, Private and Protected determines how elements of base class are inherited by the derived class Base Class Visibility Derived Class Visibility Private Public Protected Private Not Inherited Not Inherited Not Inherited Public Private Public Protected Protected Private Protected Protected Types of Inheritance: 1. Single Inheritance 2. Multiple Inheritance 3. Hierarchical Inheritance 4. Multilevel Inheritance 5. Hybrid Inheritance 1.Single Inheritance: Definition: A Derived Class with only one Base class is called as Single Inheritance. Diagrammatic Representation: Base Class (B) Derived Class (D) Fig: Single Inheritance M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 3
4 Syntax: Class Base-Classname Class Derived-Class-name : Visibility-Mode Base-Class-name Example 1: //Single inheritance: public #include<iostream.h> #include<conio.h> class B int a; void get_a(); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 4
5 void B::get_a() cout<<"enter the value of A: "; cin>>a; class D:public B int b; void get_b(); void D::get_b() cout<<"enter the value of B: "; cin>>b; int c; c=a+b; cout<<"the sum of A and B is: "<<c; void main() clrscr(); D d1; d1.get_a(); d1.get_b(); getch(); Output: Enter the value of A: 12 Enter the value of B: 22 The sum of A and B is: 34 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 5
6 Example 2: //Single inheritance: private #include<iostream.h> #include<conio.h> class B int a; void get_a(); void B::get_a() cout<<"enter the value of A: "; cin>>a; class D:private B int b; void get_b(); void D::get_b() get_a( ); cout<<"enter the value of B: "; cin>>b; int c; c=a+b; cout<<"the sum of A and B is: "<<c; M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 6
7 void main() clrscr(); D d1; d1.get_b(); getch(); Output: Enter the value of A: 12 Enter the value of B: 22 The sum of A and B is: Multiple Inheritance Definition: A Derived Class derived from several Base class is called as Multiple Inheritance. Diagrammatic Representation: Base Class 1 Base Class 2 Base Class 3 Derived Class Fig: Multiple Inheritance M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 7
8 Syntax: Class Derived-Classname : Visibility BaseClass-Name 1, Visibility BaseClass-Name 2 Example: //multiple inheritance #include<iostream.h> #include<conio.h> class M int m; void get_m(int); class N int n; void get_n(int); class P:public M, public N void display(void); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 8
9 void M::get_m(int x) m=x; void N::get_n(int y) n=y; void P::display(void) cout<<"m="<<m<<"\n"; cout<<"n="<<n<<"\n"; cout<<"m*n="<<m*n<<"\n"; void main() clrscr(); P p; p.get_m(10); p.get_n(20); p.display(); getch(); Output: m=10 n=20 m*n= Hierarchical Inheritance: Definition: A Base Class has many Derived Class is called as Hierarchical Inheritance. Diagrammatic Representation: Base Class Derived Class 1 Derived Class 2 Derived Class 3 Fig: Hierarchical Inheritance M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 9
10 Syntax: Class Derived-Classname 1 : Visibility-Mode BaseClass-Name Class Derived-Classname 2 : Visibility-Mode BaseClass-Name 4.Multilevel Inheritance: Definition: Mechanism of deriving a class from Another Derived Class is known as Multilevel Inheritance Diagrammatic Representation: Base Class Derived Class 1 Derived Class 2 Fig: Multilevel Inheritance M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 10
11 Syntax: Class Base-Classname Class Derived-Classname 1 : Visibility-Mode BaseClass-Name Class Derived-Classname 2 : Visibility-Mode Derived-Classname 1 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 11
12 Example: //Multilevel Inheritance #include<iostream.h> #include<conio.h> class student int roll_number; void get_number(int); void put_number(void); void student::get_number(int a) roll_number=a; void student::put_number() cout<<"roll number:"<<roll_number<<"\n"; class test:public student float sub1; float sub2; void get_marks(float,float); void put_marks(void); void test::get_marks(float x,float y) sub1=x; sub2=y; void test::put_marks() cout<<"\nmarks in sub 1="<<sub1<<"\n"; cout<<"\nmarks in sub 2="<<sub2<<"\n"; M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 12
13 class result : public test float total; void display(void); void result::display(void) total=sub1+sub2; put_number(); put_marks(); cout<<"total="<<total<<"\n"; void main() clrscr(); result student1; student1.get_number(111); student1.get_marks(98.0,95.5); student1.display(); getch(); OUTPUT: Roll number:10 Marks in sub 1=98 Marks in sub 2=95.5 Total=193.5 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 13
14 5.Hybrid Inheritance: Definition: Hybrid Inheritance is combination of two or more inheritance Diagrammatic Representation: Base Class Derived Class 1 Derived Class 2 Derived Class 3 Fig : Hybrid Inheritance Syntax: Class Base-Classname 1 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 14
15 Class Derived-Classname 1 : Visibility-Mode BaseClass-Name 1 Class Base-Classname 2 Class Derived-Classname 2 : Visibility Derived-Classname 1, Visibility Base-Classname 2 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 15
16 Example: //Hybrid Inheritance #include<iostream.h> #include<conio.h> class student int roll_number; void get_number(int a) roll_number=a; void put_number(void) cout<<"roll number:"<<roll_number<<"\n"; class test : public student float part1,part2; void get_mark(float x,float y) part1=x; part2=y; void put_marks(void) cout<<"marks obtained:"<<"\n"; cout<<"part1="<<part1<<"\n"; cout<<"part2="<<part2<<"\n"; M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 16
17 class sports float score; void get_score(float c) score=c; void put_score(void) cout<<"sport wt:"<<score<<"\n"; class result:public test,public sports float total; void display(void); void result::display(void) total=part1+part2+score; put_number(); put_marks(); put_score(); cout<<"\ntotal score="<<total<<"\n"; void main() clrscr(); result student1; student1.get_number(10); student1.get_mark(27.5,33.0); student1.get_score(6.0); student1.display(); getch(); M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 17
18 Output: Roll number:10 Marks obtained: Part 1=27.5 Part 2=33 Sport wt:6 Total score=66.5 M.EZHILVENDAN [AP/IT] [Jawahar Engineering College - Chennai] Page 18
Developed By Strawberry
Experiment No. 8 PART A (PART A: TO BE REFFERED BY STUDENTS) A.1 Aim: To understand the below concept of Inheritance (Part II) P1: Consider the class hierarchy in the figure below. The class master derives
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 informationLecture 6. Inheritance
Inheritance Lecture 6 A key feature of C++ classes is inheritance. Inheritance allows to create classes which are derived from other classes, so that they automatically include some of its "parent's" members,
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 informationOBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES
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.
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 information44 Inheritance. Prof.Manoj S.Kavedia
44 Inheritance Syllabus Concepts of inheritance, Derived classes, Member declaration (Protected), Types of inheritance (Single, multilevel, multiple, hierarchical, Hybrid inheritance), Virtual base classes,
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 informationCognitive Information Complexity Measure of Object-Oriented Program
Cognitive Information Complexity Measure of Object-Oriented Program DHARMENDER SINGH KUSHWAHA, R.K.SINGH and A.K.MISRA Department of Computer Science and Engineering Moti Lal Nehru National Institute Of
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) Differentiate between Object Oriented Programming
More information/* Program that accepts a shopping list of five items from the command line and stores them in a vector */
/* Program that accepts a shopping list of five items from the command line and stores them in a vector */ import java.util.*; // load Vector class class ShoppingList public static void main(string args[
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 information1. a) Attempt any SIX of the following: Marks 12 i) What is Data abstraction?
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 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 informationCHAPTER 9 INHERITANCE. 9.1 Introduction
CHAPTER 9 INHERITANCE 9.1 Introduction Inheritance is the most powerful feature of an object oriented programming language. It is a process of creating new classes called derived classes, from the existing
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 informationA study on object oriented programming with c++
A study on object oriented programming with c++ Navpreet singh 17858 Dronacharya college of engineering India Abstract - C++ strongly supports the concept of Reusability. The C++ classes can be reused
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 informationSTUDY ON INHERITANCE OF CLASSES
STUDY ON INHERITANCE OF CLASSES Pallav Thapa Deaprtment Of Information Technology, Dronacharya College Of Engineering, Gurgaon Abstract-.This paper address about the inheritance in object oriented programming.
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 informationInternational Journal of Advance Research in Computer Science and Management Studies
Volume 3, Issue 1, January 2015 ISSN: 2321 7782 (Online) International Journal of Advance Research in Computer Science and Management Studies Research Article / Survey Paper / Case Study Available online
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 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 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 informationObject Oriented Programming using C++ INHERITANCE
Object Oriented Programming using C++ INHERITANCE 02-05-2017 1 What is Inheritance? A mechanism for code reuse. New classes created from existing classes Absorb attributes and behaviors. Defining new class
More informationSahaj Computer Solutions OOPS WITH C++
Chapter 6 1 Contents Introduction Types of Inheritances Defining the Derived Class Single Inheritance Making a private data inheritable Multilevel Inheritance Multiple Inheritance Ambiguity Resolution
More information2016 COMPUTER SCIENCE
Total number of printed pages: 5 Total marks : 70 2016 COMPUTER SCIENCE Time : 3 hours General instructions: i) Approximately 15 minutes is allotted to read the question paper and revise the answers. ii)
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 informationThe syntax of structure declaration is. struct structure_name { type element 1; type element 2; type element n;
Structure A structure is a user defined data type. We know that arrays can be used to represent a group of data items that belong to the same type, such as int or float. However we cannot use an array
More informationINHERITANCE DEFINING DERIVE CLASS :
INHERITANCE Inheritance Inheritance is a way or technique or method which is use to acquire the properties and methods of old class in to newly created class. Inheritance is the process by which one object
More informationINDEX SL.NO NAME OF PROGRAMS PAGE NO REMARKS PROGRAM TO FIND FACTORIAL OF THREE
INDEX SL.NO NAME OF PROGRAMS PAGE NO REMARKS PROGRAM TO FIND FACTORIAL OF THREE 1 NUMBERS PROGRAM FOR SUM OF SERIES USING 2 MATHPOWER METHOD 3 PROGRAM ON COMMAND LINE ARGUMENT 4 PROGRAM TO PRINT FIBONACI
More informationInheritance
Inheritance 23-01-2016 Inheritance Inheritance is the capability of one class to acquire properties and characteristics from another class. For using Inheritance concept in our program we must use at least
More informationCS OBJECT ORIENTED PROGRAMMING
UNIT-4 INHERITANCE AND RUN TIME POLYMORPHISM Inheritance public, private, and protected derivations multiple inheritance virtual base class abstract class composite objects Runtime polymorphism virtual
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 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 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 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 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 informationDr. Binu P Chacko Associate Professor. Prajyoti Niketan College, Pudukkad, THRISSUR
C++ Dr. Binu P Chacko Associate Professor Department ofcomputer Science Prajyoti Niketan College, Pudukkad, THRISSUR Fundamentals OOP language developed by Bjarne Stroustrup at AT & T Bell Lb Laboratories
More informationBase class or Super class. Subclass or Derived class
INHERITANCE is the capability of one class to inherit the properties from another class. generates a model that is closer to the real world. NEED FOR INHERITANCE 1 Closeness with the real world model 3
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 informationUNIT - V. Inheritance Interfaces and inner classes Exception handling Threads Streams and I/O
UNIT - V Inheritance Interfaces and inner classes Exception handling Threads Streams and I/O 1 INHERITANCE 2 INHERITANCE What is Inheritance? Inheritance is the mechanism which allows a class B to inherit
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 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 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 informationCOMPUTER SCIENCE (CODE 083) CLASS XII Time allowed : 3Hours Maximum. Marks 70
Ashok Garg - 9149405 Code No.08 Roll No. Candidate must write the Code on the title page of the answer-book Please check that this question paper contains 8 printed pages. Code number given on the right
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 informationINHERITANCE IN OBJECT ORIENTED PROGRAMMING EASIEST WAY TO TEACH AND LEARN INHERITANCE IN C++ TWINKLE PATEL
International Journal of Computer Science Engineering and Information Technology Research (IJCSEITR) ISSN(P): 2249-6831; ISSN(E): 2249-7943 Vol. 7, Issue 1, Feb 2017, 21-34 TJPRC Pvt. Ltd. INHERITANCE
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 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 informationClasses. Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT).
UNITII Classes Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT). It s a User Defined Data-type. The Data declared in a Class are called Data- Members
More informationBE III Semester ISE Page 1 of 1
Scheme of Valuation Date : 29-09-2015 Max Marks : 50 Marks Subject & Code: Object Oriented Programming with C++ (10CS36) Semester & Section: III A & B Name of Faculty: Prof.Sandesh & Mrs.Saritha Time :
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 informationData 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 information22316 Course Title : Object Oriented Programming using C++ Max. Marks : 70 Time: 3 Hrs.
Scheme I Sample Question Paper Program Name : Computer Engineering Program Group Program Code : CO/CM/IF/CW Semester : Third 22316 Course Title : Object Oriented Programming using C++ Max. Marks : 70 Time:
More informationChapter-14 STRUCTURES
Chapter-14 STRUCTURES Introduction: We have seen variables of simple data types, such as float, char, and int. Variables of such types represent one item of information: a height, an amount, a count, and
More informationINHERITANCE. PART I Choose the correct answers
m m Unit - IV CHAPTER 16 m m INHERITANCE m m PART I Choose the correct answers m m 1. Which of the followingis the process of creating new classes from an existing class (a) Polymorphism (b) Inheritance
More informationObject Oriented Programming
Object Oriented Programming in C++ CHAPTER 01 Introduction to OOP & C++ Difference between Procedure Oriented and Object Oriented Programming Procedure Oriented Programming Object Oriented Programming
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 informationUNIT III- INHERITANCE AND POLYMORPHISM
UNIT III- INHERITANCE AND POLYMORPHISM Objectives: To introduce Inheritance in C++ and to explain its importance. To make understand the different types of inheritance. To define typing conversion and
More informationDownloaded S. from Kiran, PGT (CS) KV, Malleswaram STRUCTURES. Downloaded from
Downloaded S. from Kiran, www.studiestoday.com PGT (CS) KV, STRUCTURES WHAT IS A STRUCTURE? Structure is a collection of logically related data. It is also a collection of dissimilar datatype. Downloaded
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 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 informationDeveloped By Strawberry
Experiment No. 9 PART A (PART A: TO BE REFFERED BY STUDENTS) A.1 Aim: To study virtual functions and Polymorphism P1: Create a base class called 'SHAPE' having - two data members of type double - member
More information---
Bharathi Hr. Sec. School, Reddipatty..1.. A. Prabhakar, M.C.A.,B.Ed., Enter the given text: Heaven from all creatures hides the book of fate. All but the page prescribe the present state. A hero perishes
More informationPadasalai.Net s Model Question Paper
Padasalai.Net s Model Question Paper STD: XII VOLUME - 2 MARKS: 150 SUB: COMPUTER SCIENCE TIME: 3 HRS PART I Choose the correct answer: 75 X 1 = 75 1. Which of the following is an object oriented programming
More informationFriend Functions, Inheritance
Friend Functions, Inheritance Friend Function Private data member of a class can not be accessed by an object of another class Similarly protected data member function of a class can not be accessed 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 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 informationGovernment Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING
Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING THROUGH C++ Practical: OOPS THROUGH C++ Subject Code: 1618407 PROGRAM NO.1 Programming exercise on executing a Basic C++
More informationThe mechanism that allows us to extend the definition of a class without making any physical changes to the existing class is called inheritance.
Class : BCA 3rd Semester Course Code: BCA-S3-03 Course Title: Object Oriented Programming Concepts in C++ Unit III Inheritance The mechanism that allows us to extend the definition of a class without making
More informationDELHI PUBLIC SCHOOL, Durgapur QUESTION BANK & REVISION SHEET OF COMPUTER FOR FINAL EXAMINATION ( ) CLASS-VIIi Computer CHAPTER-CREATING MY
DELHI PUBLIC SCHOOL, Durgapur QUESTION BANK & REVISION SHEET OF COMPUTER FOR FINAL EXAMINATION (2017-18) CLASS-VIIi Computer CHAPTER-CREATING MY FIRST VIDEO, CREATING A DOCUMENTARY, APPLYING SPECIAL EFFECTS
More informationUNIT - IV INHERITANCE AND FORMATTED I/O
UNIT - IV INHERITANCE AND FORMATTED I/O CONTENTS: Inheritance Public, private and protected derivations Multiple inheritance Virtual base class Abstract class Composite objects Runtime polymorphism\ Virtual
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 informationSample Paper - II Subject Computer Science
Sample Paper - II Subject Computer Science Max Marks 70 Duration 3 hrs Note:- All questions are compulsory Q1) a) What is significance of My Computer? 2 b) Explain different types of operating systems.
More informationinclude<iostream.h> #define PI=3.14 void main( ) { float r;a; cout<< enter any radius ; cin>>r; a=pi*pow(r,2); cout<< Area= <<a }
1. Explain Gloabal and local variable with suitable example. 2. Difference between a runtime error and a syntax error. Give one example of each. 3. Difference between formal parameters and actual parameters.
More informationQ (Quaternary) Search Algorithm
Q (Quaternary) Search Algorithm Taranjit Khokhar Abstract In computer science, there are many ways to search the position of the required input value in an array. There are algorithms such as binary search
More informationRAJIV GANDHI COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY OBJECT ORIENTED PROGRAMMING QUESTION BANK UNIT I 2 MARKS
RAJIV GANDHI COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY OBJECT ORIENTED PROGRAMMING YEAR/SEM:II & III UNIT I 1) Give the evolution diagram of OOPS concept. 2) Give some
More informationConstructor - example
Constructors A constructor is a special member function whose task is to initialize the objects of its class. It is special because its name is same as the class name. The constructor is invoked whenever
More informationLab Manual on Soft Computing [CS-801]
2014 Lab Manual on Soft Computing [CS-801] Ms. ShiIpi Jain Ms. Rakhi Arora INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT, GWALIOR 01-Feb-2014 1 SOFTWARE REQUIREMENT : 1. Turbo C++ IDE (TurboC3) 2. Borland
More informationIt is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.
Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting
More informationACS COLLEGE OF ENGINEERING DEPARTMENT OF BIOMEDICAL ENGINEERING
ACS COLLEGE OF ENGINEERING DEPARTMENT OF BIOMEDICAL ENGINEERING C++ and Data Structures Pre -Lab questions(2015-2016) Cycle -1 1. Which is not an integer data type? 2. Which is a numeric data type? 3.
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 informationSri Vidya College of Engineering & Technology
UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the
More informationADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1
NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.
More informationOBJECTS. An object is an entity around us, perceivable through our senses. Types of Object: Objects that operate independently.
OBJECTS An object is an entity around us, perceivable through our senses. Types of Object: Objects that operate independently. Objects that work in associations with each others. Objects that frequently
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 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 informationObject-Oriented Programming (OOP) Fundamental Principles of OOP
Object-Oriented Programming (OOP) O b j e c t O r i e n t e d P r o g r a m m i n g 1 Object-oriented programming is the successor of procedural programming. The problem with procedural programming is
More informationSRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS
SRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS 1. How to work with multiple documents in StarOffice Writer? 2. What is meant by
More informationControl Structure and Loop Statements
Control Structure and Loop Statements A C/C++ program executes in sequential order that is the way the instructions are written. There are situations when we have to skip certain code in the program and
More informationGuru Gobind Singh Public School Sector: V/B, Bokaro Steel City Assignment (Level 2)
Subject : Computer Science Class : XII Guru Gobind Singh Public School Sector: V/B, Bokaro Steel City Assignment (Level 2) 1. Out of the following, find those identifiers, which cannot be used for naming
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 informationInheritance Inheritance :
: is the process of creating a new class(derived classes) from existing classes( ase lasses). The derived classes not only inherit the capabilities of the base class abut also can add new features of their
More informationArrays in C. By Mrs. Manisha Kuveskar.
Arrays in C By Mrs. Manisha Kuveskar. C Programming Arrays An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you
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 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 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 information5119: PRIYADARSHINI ENGINEERING COLLEGE, VANIYAMBADI (Approved By Aicte, New Delhi.Affiliatted To Anna University)
5119: PRIYADARSHINI ENGINEERING COLLEGE, VANIYAMBADI-635 751 (Approved By Aicte, New Delhi.Affiliatted To Anna University) DEPARTMENT OF COMPUTER APPPLICATIONS CS6461-Object Oriented Programming Lab-Manual
More information1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms.
PROBLEM: 1. FIBONACCI SERIES Write a C++ program to generate the Fibonacci for n terms. AIM: To write a C++ program to generate the Fibonacci for n terms. PROGRAM CODING: #include #include
More information