Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

Similar documents
Object Oriented Programming. Solved MCQs - Part 2

C++ Important Questions with Answers

Polymorphism. Zimmer CSCI 330

C++ (Non for C Programmer) (BT307) 40 Hours

RAJIV GANDHI COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY OBJECT ORIENTED PROGRAMMING QUESTION BANK UNIT I 2 MARKS

And Even More and More C++ Fundamentals of Computer Science

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CS304 Object Oriented Programming Final Term

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

Classes and Objects. Class scope: - private members are only accessible by the class methods.

Instantiation of Template class

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

Inheritance and Polymorphism

Short Notes of CS201

Inheritance and Polymorphism

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

VALLIAMMAI ENGINEERING COLLEGE

CS201 - Introduction to Programming Glossary By

XII- COMPUTER SCIENCE VOL-II MODEL TEST I

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1

C++ Programming: Polymorphism

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

Object Oriented Programming

Introduction to Programming Using Java (98-388)

CS 162, Lecture 25: Exam II Review. 30 May 2018

THE 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.

C++ for System Developers with Design Pattern

Advanced C++ Topics. Alexander Warg, 2017

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

Interview Questions of C++

CS304 Object Oriented Programming

Object Oriented Programming with c++ Question Bank

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

ECE 3574: Dynamic Polymorphism using Inheritance

Introduction to OOP. Procedural Programming sequence of statements to solve a problem.

More C++ : Vectors, Classes, Inheritance, Templates


(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

G Programming Languages - Fall 2012

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

What is Polymorphism? Quotes from Deitel & Deitel s. Why polymorphism? How? How? Polymorphism Part 1

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

CLASSES AND OBJECTS IN JAVA

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

CS105 C++ Lecture 7. More on Classes, Inheritance

UNIVERSITY OF SWAZILAND

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

Polymorphism Part 1 1

Data Abstraction. Hwansoo Han

Get Unique study materials from

Operator overloading. Conversions. friend. inline

Object Oriented Software Design II

Software Engineering Concepts: Invariants Silently Written & Called Functions Simple Class Example

Fast Introduction to Object Oriented Programming and C++

Programming II (CS300)

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

Review and Recursion

Chapter 5 Object-Oriented Programming

Object Oriented Software Design II

Programming, numerics and optimization

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; }

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

G52CPP C++ Programming Lecture 13

C++ Inheritance and Encapsulation

STRUCTURING OF PROGRAM

OBJECT ORIENTED PROGRAMMING USING C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Inheritance, Polymorphism and the Object Memory Model

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

C++ PROGRAMMING LANGUAGE: CLASSES. CAAM 519, CHAPTER 13

Object-Oriented Programming

CS304- Object Oriented Programming LATEST SOLVED MCQS FROM FINALTERM PAPERS. MC

Inheritance, and Polymorphism.

OBJECT ORIENTED DATA STRUCTURE & ALGORITHMS

Object Oriented Paradigm

KLiC C++ Programming. (KLiC Certificate in C++ Programming)

Polymorphism. Arizona State University 1

C++ Crash Kurs. Polymorphism. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck

CGS 2405 Advanced Programming with C++ Course Justification

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

B.C.A 2017 OBJECT ORIENTED PROGRAMMING USING C++ BCA303T MODULE SPECIFICATION SHEET


Object-Oriented Principles and Practice / C++

Object Oriented Programming in C++ Basics of OOP

Chapter 6 Introduction to Defining Classes

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

explicit class and default definitions revision of SC22/WG21/N1582 =

What are the characteristics of Object Oriented programming language?

Evolution of Programming Languages

KOM3191 Object Oriented Programming Dr Muharrem Mercimek OPERATOR OVERLOADING. KOM3191 Object-Oriented Programming

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 12: Classes and Data Abstraction

XII CS(EM) Minimum Question List N.KANNAN M.Sc., B.Ed COMPUTER SCIENCE IMPORTANT QUESTION (TWO MARKS) CHAPTER 1 TO 5 ( STAR OFFICE WRITER)

Transcription:

Intro to OOP - Object and class - The sequence to define and use a class in a program - How/when to use scope resolution operator - How/when to the dot operator - Should be able to write the prototype and implementation of a simple class Visibility/protection levels and constructors - What are the visibility levels in C++? Why these levels? - When can one access public members, when can one access private members? - What is the constructor of a class? - When is the constructor executed? - What is a default constructor? - How to invoke non-default constructor? Friend, convert constructor, destructor - How to declare a friend function? - What can a friend function do? - What is the difference between a friend function and a normal function? - Is a friend function public or private? - friend function.vs. member function - What is a convert constructor, when is it called? - How to disable the implicit invocation of a conversion constructor? - What is a copy constructor and what does it do (shallow vs deep copy). - When is a copy constructor called - What does a copy constructor look like and why are the parameters passed the way they are. - How is a copy constructor declared and implemented (with deep and shallow copies). - What is a destructor? When it is called? Operator overloading - What effect does operator overloading achieve? - overload operators need to be able to implement: ==,!=, >, >=, <, <=, = - Overloading >> and << operator as friend functions - Expressions with operator form and function form: a<=b is the following using function call syntax a.operator<=(b) - Need to able to be write code for operator overloading - How is an assignment operator different from a copy constructor? (and how it differs from the copy constructor). - What does the signature for the assignment operator look like. - What does it return and why

The const and static keywords - Understand each of the const used in the following program. Class SomeClass { public: abc(); void show() const; // const 1 void what(); private: void print(const abc & x); // const 2 int c; const int d; // const 3 static const int f; // const 4 }; main() { const int I = 10; // const 5 const char *p; //const 6 char * const p; //const 7 } - What is a const member function? - What is a const object? - What is const member data? - What is the use of initialization list (ctor) as regarding const data members? - What is static used for? - What is a static member function s limitation? - What is a static const used for? - What is the difference between class and instance data and methods? - What the difference between a const pointer and pointer to constant data? - What is the difference between a statically allocated array and a const pointer? Composition - Be able to code with objects within objects - The order of constructor invocation for objects within objects - The use of ctor initialization list - The use of the dot operator for object within object - Use of derefencing with member selection Array of objects - Be able to use and declare array of objects - Know how to access each object element - Know how to access the public members of an object element

Pointers - Relationship between variable value, variable address, pointers and reference - Pointer assignment, deference - What is problem with returning a pointer to a local function variable from a function? - Pointer arithmetic - Array form and pointer form for access array elements A[100] == *(A+100) Overloading/Dynamic memory allocation - Operator overloading with different types. - Under what situation should we use dynamic allocation of memory. - How to allocate/delete an item and an array of items. - the '->' operator: M1_ptr->simplify( ) == (*M1_ptr).simplify( ); - Correct use of new/delete for single memory address and contiguous allocated memory 'this' pointer: - Know what it is all about. - Use of this in instance members - Use in assignment operator - Why can t this be used in static members? Inheritance: - Know the basics - derived vs. base - How to declare - How the is a relationship works - Why use inheritance - Be able to look at a derived class and know what it has access to. - Know the order in which constructors will run - Know how to pass parameters to base class from derived constructors. - How to specify in a derived class the parent class constructor to execute. - What constructors are provided by compiler what is the default called constructor when derived class does not specify. - Know about function overriding - Know about scoping Polymorphism: - Know how to create and use an array of pointers to a polymorphic hierarchy. - Know about pure virtual functions and abstract class. - Know dynamic casting and how to use and why to use. - Know typeid and why to use. - Know the purpose of polymorphism

Standard Template Library: - Know how to declare and use containers - Know how to use associative containers - Know how to use sequential containers - Know how to use adaptive containers - Know how to use container iterators - Know best practices for containers used during the semester

OOP Design and Implementation OOP Review Sheet The development of a successful system depends not only on the use of the appropriate methods and techniques but also on the developer s commitment to the objectives of the systems. A successful system must: 1. Satisfy the user requirements, 2. be easy to understand by the users and operators, 3. be easy to operate, 4. have a good user interface, 5. be easy to modify, 6. be expandable, 7. have adequate security controls against misuse of data, 8. handle the errors and exceptions satisfactorily, and 9. Be delivered on schedule within the budget. The object-oriented analysis (OOA) approach consists of the following steps: 1. Understanding the problem. 2. Drawing the specification of requirement of the user and the software. 3. Identifying the objects and their attributes. 4. Identifying the services that each object is expected to provide (interface). 5. Establishing inter-connections (collaborations) between the objects in terms of services required and services rendered. The object oriented design (OOD) approach may involve the following steps: 1. Review of objects created in the analysis phase. 2. Specification of class dependencies. 3. Organization of class hierarchies. 4. Design of classes. 5. Design of member functions. 6. Design of driver program. For a class to be useful, it must contain the following functions, in addition to service functions: 1. Class management functions. a. How an object is created? b. How an object is destroyed? 2. Class implementation functions. 3. What operations are performed on the data type of a class? 4. Classes access functions. How do we get information about the internal variables of the class? 5. Class utility functions. How do we handle errors?

6. Other issues that are to be considered are: a. What kinds of access controls are required for the base classes? b. Which function can be made virtual? c. What library classes are expected to be used in a class? d. The design of the individual classes has a major impact on the overall quality of the software/ Given below are some guidelines that should be considered while designing a class: The public interface of a class should have only functions of the class. An object of one class should not send a message directly to a member of another class. A function should be declared public only when it is required to be used by the objects of the class. A class should be dependent on as few classes as possible. Interaction between two classes must be explicit. The top class of a structure should represent the abstract model of the target concept. Five most important features, that a software developer should keep in mind while designing a system. 1. Describe why the testing of software is important. 2. What do you mean by maintenance of software? How and when it is done? 3. Who are the major players in each stage of the system development life cycle? 4. What are the limitations of the classic software development life cycle? 5. Software development process is an iterative process. Discuss. 6. Distinguish between the Water-fall model and the fountain model. 7. Distinguish between object-oriented system analysis and system design. Which of the two require more creative talents of the system developer? 8. Distinguish between the following: (a) Classification relationship and composition relationship (b) Inheritance relationship and client-server relationship. (c) Object in problem space and object in solution space. (d) Data flow diagrams and hierarchical charts. 9. Discuss the application of structured design techniques in object-oriented programming. 10. What are the critical issues that are to be considered while designing the driver program? Why? 11. What is prototyping? How does it help improve the system design?