OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
|
|
- Brice McKinney
- 5 years ago
- Views:
Transcription
1 OBJECT ORIENTED PROGRAMMING Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
2 OBJECT ORIENTED PARADIGM Object 2 Object 1 Data Data Function Function Object 3 Data Function 2
3 WHAT IS A MODEL? A model is an abstraction of something Purpose is to understand the product before developing it Examples Model Highway maps Architectural models Mechanical models
4 EXAMPLE OO MODEL
5 EXAMPLE OO MODEL Objects Ali House Car Tree Interactions Ali lives in the house Ali drives the car Ali lives-in House drives Car Tree
6 OBJECT ORIENTED PROGRAMMING Objects have both data and methods Objects of the same class have the same data elements and methods Objects send and receive messages to invoke actions 6
7 BASIC TERMINOLOGY object - An object is an instance of a class which combines both data and functions together. Method - an action performed by an object (a verb) Attribute - description of objects in a class class - a category of similar objects - does not hold any values of the object s attributes By default all members declared inside a class are private to that class 7
8 STRUCTURE OF C++ PROGRAM HEADERS CLASS DECLARATION MEMBER FUNCTION DEFINITIONS MAIN FUNCTION 8
9 FEATURES OF OOP 1. Classes 2. Objects 3. Data encapsulation 4. Data abstraction 5. Inheritance 6. Polymorphism 7. Dynamic binding 8. Message passing 9
10 BENEFITS OF OOP OOP offers better implementation OOP offers better data security OOP offers better code reusability OOP offers more flexibility User defined data types can be easily constructed 10
11 CLASSES IN C++ A class definition begins with the keyword class. The body of the class is contained within a set of braces, (notice the semi-colon). class class_name... }; }; Any valid identifier Class body (data member + methods) 11
12 CLASS EXAMPLE This class example shows how we can encapsulate (gather) a circle information into one package (unit or class) class Circle private: double radius; public: void setradius(double r); double getdiameter(); double getarea(); double getcircumference(); }; No need for others classes to access and retrieve its value directly. The class methods are responsible for that only. They are accessible from outside the class, and they can access the member (radius) 12
13 class Circle private: double radius; public: Circle() radius = 0.0;} Circle(int r); void setradius(double r)radius = r;} double getdiameter() return radius *2;} double getarea(); double getcircumference(); }; Circle::Circle(int r) radius = r; } double Circle::getArea() return radius * radius * (22.0/7); } double Circle:: getcircumference() return 2 * radius * (22.0/7); } Scope resolution operator :: Defined outside class 13
14 FUNDAMENTAL OF OOP C++ #include directive main () function Class Variables & Functions Input, output operators Cascading I/O operators Comments Example C++ program Creating source file Compile & Execute the c++ programs 14
15 INPUT OPERATORS cin >> variable-name; Meaning: read the value of the variable called <variable-name> from the user Example: cin >> a; cin >> b >> c; cin >> x; cin >> my-character; 15
16 OUTPUT OPERATORS cout << variable-name; Meaning: print the value of variable <variable-name> to the user cout << any message ; Meaning: print the message within quotes to the user cout << endl; Meaning: print a new line Example: cout << a; cout << b << c; cout << This is my character: << my-character << end << endl; 16
17 DIFFERENCE B/W C AND C++ C Language C++ Language Procedural Programming Language Object Oriented Programming Language Headerfile : #include<stdio.h> #include<iostream.h> \n is used to go to the next line we can use endl statement Local variables declared only the start of a C program It can be declared anywhere in a program, before they are used Return type for a function is optional Return type must be specified Do not permit data Hiding They permit data hiding Bydefault structure members are public class members are private We can call a main() function within a program This is not allowed 17
18 TOKENS, KEYWORDS AND IDENTIFIERS Tokens, a smallest individual units. Keywords, identifiers, constants,..etc Keywords implements specific c++ language features Identifiers refers the names of variables, functions, arrays..etc 18
19 DATA TYPES Datatypes User defined: Class Structure Union Enum Built-in Derived: Array Pointers Function 19
20 STRUCTURE Structure is the collection of variables of different types under a single name for better visualization of problem. Arrays is also collection of data but arrays can hold data of only one type whereas structure can hold data of one or more types. struct person char name[50]; int age; float salary; }; How to define a structure variable? person bill; How to access members of a structure? bill.age = 50; 20
21 UNION Unions in C++ is a user defined data type that uses the same memory as other objects from a list of objects. At an instance it contains only a single object. Example #include <iostream.h> union Emp int num; double sal; }; int main() Emp value; value.num = 2; cout << "Employee Number::" << value.num << "\nsalary is:: " << value.sal << endl; value.sal = ; cout << "Employee Number::" << value.num << "\nsalary is:: " << value.sal << endl; return 0; } 21
22 BUILT-IN DATATYPES 22
23 ARRAY Array is a collection of elements of same type referred using a unique name. Each element of an array are stored in memory locations indexed from 0 through n number of its elements. The lowest indexed will be the first element and highest indexed the last element of an array. type array_name[array_size_1] int age[5]; 23
24 EXAMPLE #include <iostream.h> void main() int i; float mark[6]; cout << "Enter the marks of your 6 subjects:: \n"; for(i=0; i<6; i++) cin >> mark[i]; } float sum=0; for(i=0;i<6;i++) sum += mark[i]; } float ave = sum/6; cout << "Average Marks is::" << ave << '\n'; } 24
25 POINTERS Store the address of other variable int x; // int variable int *ip; // int pointer ip=&x; //address of x assigned to ip *ip=10; // 10 assigned to x indirectly 25
26 OPERATORS Scope resolution operator :: Member dereferencing operator ->,*,::* Memory management operator malloc(),sizeof(),new,delete free () Manipulators endl and setw Type cast operators type_name (expression) 26
27 OPERATORS Arithmetic operators operators + met Addition Example x=10,y=5 x+y -> 21 - Subtraction X-y -> 5 * Multiplication X*y -> 50 / Division x/y -> 2 % Modulo Division X%y -> 0 Relational Operators Opera tor Meaning Example Result valu e < Less Than x=10,y=5 X<y False 0 > Greater Than X>y True 1 <= Less than or Equal to X<=y False 0 >= Greater than or equal to X>=y True 1!= Not Equal to X!=y False 0 == Equal To X==y False 0 27
28 EXPRESSIONS Constant Expressions Integral expressions Float expressions Pointer expressions Relational expressions Logical expressions Bitwise expressions 28
29 CONTROL STRUCTURES if if else Nested if switch do while while for 29
30 LOOPS For loop for(initialization statement; test expression; update statement) codes to be executed; } While loop while (test expression) statement/s to be executed. } 30
31 LOOPS Do while do statement/s; } while (test expression); 31
32 SWITCH switch (n) case constant1: code/s to be executed if n equals to constant1; break; case constant2: code/s to be executed if n equals to constant2; break;... default: code/s to be executed if n doesn't match to any cases; } 32
33 POINTERS Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
34 POINTERS A pointer is a variable used to store the address of a memory cell. We can use the pointer to reference this memory cell datatype *var-name; Memory address: 1020 integer pointer 34
35 OPERATIONS 1. we define a pointer variables 2. assign the address of a variable to a pointer and 3. finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand 35
36 POINTER VARIABLE Declaration of Pointer variables type* pointer_name; //or type *pointer_name; where type is the type of data pointed to (e.g. int, char, double) Examples: int *n; RationalNumber *r; 36
37 CONSTRUCTORS & DESTRUCTORS Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
38 CONSTRUCTOR A class constructor is a special member function of a class that is executed whenever we create new objects of that class. A constructor will have exact same name as the class It does not have any return type at all Constructors can be very useful for setting initial values for certain member variables 38
39 EXAMPLE class Line public: void setlength( double len ); double getlength( void ); Line(); // This is the constructor private: double length; Line::Line() int main( ) cout << "Object is being created ; Line line; } // set line length line.setlength(6.0); cout << line.getlength() <<endl; void Line::setLength( double len ) length = len; } }; double Line::getLength( void ) return length; } return 0; } 39
40 PARAMETERIZED CONSTRUCTOR: A default constructor does not have any parameter, but if you need, a constructor can have parameters. This helps you to assign initial value to an object at the time of its creation 40
41 DESTRUCTOR A destructor is used to destroy the objects that have been created by the constructor class Line public: void setlength( double len ); double getlength( void ); Line(); // This is the constructor `Line(); // This is the destructor private: double length; }; 41
42 OPERATOR OVERLOADING Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
43 UNARY OPERATOR OVERLOADING The unary operators operate on a single operand and following are the examples of Unary operators: The increment (++) and decrement (--) operators. The unary minus (-) operator. The logical not (!) operator. 43
44 EXAMPLE 1 class complex int a,b,c; public: void getvalue() cout<<"enter the Two Numbers:"; cin>>a>>b; } void operator++() a=++a; b=++b; } void operator--() a=--a; b=--b; } void display() cout<<a<<"+\t"<<b<<"i"<<endl; } }; void main() clrscr(); complex obj; obj.getvalue(); obj++; cout<<"increment Complex Number\n"; obj.display(); obj--; cout<<"decrement Complex Number\n"; obj.display(); getch(); } 44
45 IN C++, FOLLOWING OPERATORS CAN NOT BE OVERLOADED:. (Member Access or Dot operator)?: (Ternary or Conditional Operator ) :: (Scope Resolution Operator).* (Pointer-to-member Operator ) sizeof (Object size Operator) 45
46 BINARY OPERATOR OVERLOADING This feature in C++ programming that allows programmer to redefine the meaning of operator when they operate on class objects is known as operator overloading. Complex number (real + imag i) addition 5+6i + 7+3i 46
47 INHERITANCE Ms. Ajeta Nandal C.R.Polytechnic,Rohtak
48 INHERITANCE Inherit the members of an existing class. This existing class is called the base class, and the new class is referred to as the derived class. Reuse the code functionality and fast implementation time. NOTE : All members of a class except Private, are inherited
49 SYNTAX class Subclass_name : access_mode Superclass_name Access Mode is used to specify, the mode in which the properties of superclass will be inherited into subclass, public, privtate or protected.
50 EXAMPLE class Animal // base class public: int legs = 4; }; class Dog : public Animal // derived class public: int tail = 1; }; int main() Dog d; cout << d.legs; cout << d.tail; }
51 A DERIVED CLASS INHERITS ALL BASE CLASS METHODS WITH THE FOLLOWING EXCEPTIONS: Constructors, destructors and copy constructors of the base class. Overloaded operators of the base class. The friend functions of the base class
52 TYPES OF INHERITANCE 1. Single Inheritance 2. Multiple Inheritance 3. Hierarchical Inheritance 4. Multilevel Inheritance 5. Hybrid Inheritance
53 SINGLE INHERITANCE In this type of inheritance one derived class inherits from only one base class. It is the most simplest form of Inheritance.
54 MULTIPLE INHERITANCE In this type of inheritance a single derived class may inherit from two or more than two base classes.
55 MULTILEVEL INHERITANCE In this type of inheritance the derived class inherits from a class, which in turn inherits from some other class. The Super class for one, is sub class for the other.
56 HIERARCHICAL INHERITANCE In this type of inheritance, multiple derived classes inherits from a single base class.
57 HYBRID INHERITANCE Hybrid Inheritance is Multilevel Inheritance. combination of Hierarchical and
58 VIRTUAL BASE CLASS Multipath inheritance may lead to duplication of inherited members from a grandparent base class. This may be avoided by making the common base class a virtual base class. When a class is made a virtual base class, C++ takes necessary care to see that only one copy of that class is inherited
59 EXAMPLE class A... }; class B1 : virtual public A... }; class B2 : virtual public A... }; class C : public B1, public B2...// only one copy of A...// will be inherited };
60 VIRTUAL FUNCTIONS Virtual Function is a function in base class, which is overrided in the derived class Virtual Keyword is used to make a member function of the base class Virtual. PURE VIRTUAL FUNCTION If expression =0 is added to a virtual function then, that function is becomes pure virtual function. Note that, adding =0 to virtual function does not assign value, it simply indicates the virtual function is a pure function. If a base class contains at least one virtual function then, that class is known as abstract class. 60
61 EXCEPTION HANDLING An exception is a problem that arises during the execution of a program. Exceptions provide a way to transfer control from one part of a program to another. C++ exception handling is built upon three keywords: try, catch, and throw. 61
62 TRY, CATCH & THROW throw: A program throws an exception when a problem shows up. This is done using a throw keyword. catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception. try: A try block identifies a block of code for which particular exceptions will be activated. It's followed by one or more catch blocks. 62
63 TRY & CATCH try // protected code } catch( ExceptionName e1 ) // catch block } catch( ExceptionName e2 ) // catch block } catch( ExceptionName en ) // catch block } You can list down multiple catch statements to catch different type of exceptions in case your try block raises more than one exception in different situations. 63
64 THROWING EXCEPTIONS Exceptions can be thrown anywhere within a code block using throw statements. The operand of the throw statements determines a type for the exception and can be any expression and the type of the result of the expression determines the type of exception thrown. 64
65 EXAMPLE double division(int a, int b) if( b == 0 ) // type of exception throw "Division by zero condition!"; } return (a/b); } 65
66 CATCHING EXCEPTIONS The catch block following the try block catches any exception. You can specify what type of exception you want to catch and this is determined by the exception declaration that appears in parentheses following the keyword catch. 66
67 DEFINE NEW EXCEPTIONS You can define your own exceptions by inheriting and overriding exception class functionality. Allows you can use std::exception class to implement your own exception in standard way 67
Object-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 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 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 informationSTUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming
More informationC++ Classes, Constructor & Object Oriented Programming
C++ Classes, Constructor & Object Oriented Programming Object Oriented Programming Programmer thinks about and defines the attributes and behavior of objects. Often the objects are modeled after real-world
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 informationSTRUCTURING OF PROGRAM
Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the
More informationOOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.
OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
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 informationI BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++
No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)
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 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 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 informationC++ Important Questions with Answers
1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children
More informationDepartment of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List
More informationInterview Questions of C++
Interview Questions of C++ Q-1 What is the full form of OOPS? Ans: Object Oriented Programming System. Q-2 What is a class? Ans: Class is a blue print which reflects the entities attributes and actions.
More informationI BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.
Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008 Certified CRISL rated 'A'
More informationCharacter Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits
More information+2 Volume II OBJECT TECHNOLOGY OBJECTIVE QUESTIONS R.Sreenivasan SanThome HSS, Chennai-4. Chapter -1
Chapter -1 1. Object Oriented programming is a way of problem solving by combining data and operation 2.The group of data and operation are termed as object. 3.An object is a group of related function
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 informationUNIT-2 Introduction to C++
UNIT-2 Introduction to C++ C++ CHARACTER SET Character set is asset of valid characters that a language can recognize. A character can represents any letter, digit, or any other sign. Following are some
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
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 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 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 informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
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 informationWhat are the characteristics of Object Oriented programming language?
What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is
More informationCS304 Object Oriented Programming
1 CS304 Object Oriented Programming 1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes?
More informationJayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT
CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT Two Mark Questions UNIT - I 1. DEFINE ENCAPSULATION. Encapsulation is the process of combining data and functions
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 informationGet Unique study materials from
Downloaded from www.rejinpaul.com VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : IV Section : EEE - 1 & 2 Subject Code
More informationChapter 1. Principles of Object Oriented Programming
Chapter 1. Principles of Object Oriented Programming Procedure Oriented Programming Vs Object Oriented Programming Procedure Oriented Programming Object Oriented Programming Divided Into In POP, program
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 informationAN OVERVIEW OF C++ 1
AN OVERVIEW OF C++ 1 OBJECTIVES Introduction What is object-oriented programming? Two versions of C++ C++ console I/O C++ comments Classes: A first look Some differences between C and C++ Introducing function
More informationCS304 Object Oriented Programming Final Term
1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes? Generalization (pg 29) Sub-typing
More informationObject Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year
Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures
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 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 informationOperators. Java operators are classified into three categories:
Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.
More informationJAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)
Estd: 1994 JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli - 621014 (An approved by AICTE and Affiliated to Anna University) ISO 9001:2000 Certified Subject Code & Name : CS 1202
More informationVALLIAMMAI ENGINEERING COLLEGE
VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED
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 informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
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 informationCS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE
CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate
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 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 informationSRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR
SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : M.Sc CST Semester / Year : EVEN / II Subject Name
More informationQuiz Start Time: 09:34 PM Time Left 82 sec(s)
Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability
More informationObject Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming
Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in
More informationAn Object Oriented Programming with C
An Object Oriented Programming with C By Tanmay Kasbe Dr. Ravi Singh Pippal IDEA PUBLISHING WWW.ideapublishing.in i Publishing-in-support-of, IDEA PUBLISHING Block- 9b, Transit Flats, Hudco Place Extension
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationCS201 Latest Solved MCQs
Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability
More informationLesson Plan. Subject: OBJECT ORIENTED PROGRAMMING USING C++ :15 weeks (From January, 2018 to April,2018)
Lesson Plan Name of the Faculty Discipline Semester :Mrs. Reena Rani : Computer Engineering : IV Subject: OBJECT ORIENTED PROGRAMMING USING C++ Lesson Plan Duration :15 weeks (From January, 2018 to April,2018)
More informationInstantiation of Template class
Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double
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 informationC++ Memory Map. A pointer is a variable that holds a memory address, usually the location of another variable in memory.
Pointer C++ Memory Map Once a program is compiled, C++ creates four logically distinct regions of memory: Code Area : Area to hold the compiled program code Data Area : Area to hold global variables Stack
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 informationAbsolute C++ Walter Savitch
Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
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 informationData Structures using OOP C++ Lecture 3
References: th 1. E Balagurusamy, Object Oriented Programming with C++, 4 edition, McGraw-Hill 2008. 2. Robert L. Kruse and Alexander J. Ryba, Data Structures and Program Design in C++, Prentice-Hall 2000.
More informationInheritance, and Polymorphism.
Inheritance and Polymorphism by Yukong Zhang Object-oriented programming languages are the most widely used modern programming languages. They model programming based on objects which are very close to
More informationObject-Oriented Programming
Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object
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 informationCS 162, Lecture 25: Exam II Review. 30 May 2018
CS 162, Lecture 25: Exam II Review 30 May 2018 True or False Pointers to a base class may be assigned the address of a derived class object. In C++ polymorphism is very difficult to achieve unless you
More informationOperators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur
Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators
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 informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering
More informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
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 information3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.
3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.
More informationDistributed Real-Time Control Systems. Lecture 17 C++ Programming Intro to C++ Objects and Classes
Distributed Real-Time Control Systems Lecture 17 C++ Programming Intro to C++ Objects and Classes 1 Bibliography Classical References Covers C++ 11 2 What is C++? A computer language with object oriented
More informationVariables. Data Types.
Variables. Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable. We had to write several lines of code, compile them, and then execute the resulting
More informationKLiC C++ Programming. (KLiC Certificate in C++ Programming)
KLiC C++ Programming (KLiC Certificate in C++ Programming) Turbo C Skills: Pre-requisite Knowledge and Skills, Inspire with C Programming, Checklist for Installation, The Programming Languages, The main
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 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 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 informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationInheritance. Transitivity
Inheritance Classes can be organized in a hierarchical structure based on the concept of inheritance Inheritance The property that instances of a sub-class can access both data and behavior associated
More informationProgramming, numerics and optimization
Programming, numerics and optimization Lecture A-4: Object-oriented programming Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428
More informationObject Oriented Programming
Object Oriented Programming Course Title: Object Oriented Programming Full Marks: 60 20 20 Course No: CSC161 Pass Marks: 24 8 8 Nature of Course: Theory Lab Credit Hrs: 3 Semester: II Course Description:
More information1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?
1. Describe History of C++? The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity
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 informationC++_ MARKS 40 MIN
C++_16.9.2018 40 MARKS 40 MIN https://tinyurl.com/ya62ayzs 1) Declaration of a pointer more than once may cause A. Error B. Abort C. Trap D. Null 2Whice is not a correct variable type in C++? A. float
More informationHierarchical inheritance: Contains one base class and multiple derived classes of the same base class.
1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity
More informationSyllabus of C++ Software for Hands-on Learning: This course offers the following modules: Module 1: Getting Started with C++ Programming
Syllabus of C++ Software for Hands-on Learning: Borland C++ 4.5 Turbo C ++ V 3.0 This course offers the following modules: Module 1: Getting Started with C++ Programming Audience for this Course Job Roles
More informationPreface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.
Preface to the Second Edition p. iii Preface to the First Edition p. vi Brief Contents p. ix Introduction to C++ p. 1 A Review of Structures p. 1 The Need for Structures p. 1 Creating a New Data Type Using
More informationProgramming. C++ Basics
Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++
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 informationTokens, Expressions and Control Structures
3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type
More informationPolymorphism. Zimmer CSCI 330
Polymorphism Polymorphism - is the property of OOP that allows the run-time binding of a function's name to the code that implements the function. (Run-time binding to the starting address of the code.)
More informationBy the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program
1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize
More information- HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM
www.padasalai.net - HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM 1 A 26 D 51 C 2 C 27 D 52 D 3 C 28 C 53 B 4 A 29 B 54 D 5 B 30 B 55 B 6 A 31 C 56 A 7 B 32 C 57 D 8 C 33 B 58 C
More informationDE70/DC56 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2014
Q.2a. Discuss the fundamental features of the object oriented programming. Answer The fundamentals features of the OOPs are the following: Encapsulation: It is a mechanism that associates the code and
More information