This action might not be possible to undo. Are you sure you want to continue?
of Karnataka, Department of Technical Education Diploma in Information Science & Engineering Fourth Semester Subject: OOP with C++ Contact Hrs / week: 4
Table of Contents Chapter No 1 2 3 4 5 6 7 8 9 Topic Section I Introduction to OOP C++ Additional features Classes and Objects Section II Operator Overloading Inheritance Virtual functions Section III Managing Console I/O Operations Files Templates Seminars and Guest lectures from Industry and Institute Tests Total hrs Detailed Contents 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 2 2.1 2.2 2.3 2.4 2.5 2.6 Introduction to OOP Software evolution A look at procedure oriented programming Object oriented programming paradigm Basic concepts of OOPs Benefits of OOPs Objects oriented languages Application of OOPs C++ Additional Features What is C++? The i/o stream class Tokens Comments Basic data types, User defined data types, Derived data types Symbolic constants No. of Hrs 02 06 10 06 08 06 08 06 04 05 03 64 Marks 06 15 26 16 20 16 20 16 10
Total hrs: 64
2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.16 3 3.1 3.2 3.2.1 3.2.2 3.2.3 3.3 3.3.1 3.3.2 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.10. 1 3.10. 2 3.10. 3 3.10. 4 3.10. 5 3.10. 6 3.11 3.12 3.13
Type Compatibility Declaration of variables Dynamic initialization of variables Reference variables Operators in C++: Scope resolution operator, Member dereferencing operators, Memory management operators Manipulators (setw & endl) Type cast operator Function prototyping Call by reference Return by reference Inline functions Default arguments Function overloading Classes and Objects C structures revisited Specifying a class A simple class example Creating objects Accessing class members Defining member functions Outside the class definition Inside the class definition A C++ program with class Memory allocation for objects Static data members Static member functions Arrays within a class Arrays of objects Constructors & Destructors Default constructors Parameterized constructor Overloaded constructor Constructor with default argument Copy constructor Destructor Objects as function arguments Returning objects from functions Friend functions
3.14 4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.7.1 4.7.2 4.7.3 5 5.1 5.2 5.3 5.4 5.5 5.6 5.6.1 5.7 5.8 5.9 5.10 5.11 5.12 6 6.1 6.2 6.3 6.4 6.5 6.6 7 7.1 7.2 7.3 7.4 7.5 7.6 8 8.1 8.2 8.3 8.4
Friend Class (only definition) Operator Overloading Defining operator overloading Overloading unary operator Overloading binary operator Overloading binary operator using friends Manipulation of strings using operators Rules for overloading operator Type conversions Basic to class type Class to basic type One class to another class type Inheritance Introduction Defining Derived classes Single Inheritance Making a private member inheritable Multilevel inheritance Multiple inheritance Ambiguity resolution in inheritance Hierarchical inheritance Hybrid inheritance Virtual base classes Abstract classes Constructors in Derived classes Containership : nesting of classes Virtual Functions Pointers to objects this pointer Pointers to derived classes Virtual function Rules for virtual functions Pure virtual function Managing Console I/O Operations C++ streams C++ stream classes for console I/O operations Unformatted I/O operations Formatted console I/O operations Managing output with Manipulators Designing our own manipulator Files Classes for file stream operations Opening and closing a file Detecting end of file File modes
8.5 8.6 8.7 8.8 8.9 9 9.1 9.2 9.3 9.4
File pointers and their manipulation Sequential I/O operations Updating a file : Random Access Error handling functions Command line arguments Templates Class templates Function templates Member function templates Non Type Template argument
General Objectives: 1. 2. 3. 4. 5. 6. 7. 8. 9. Understand the concepts of OOPs, their advantages and applications Comprehend the features of C++ Know to create classes, objects, constructors and destructors Know the concepts and advantages of overloading operator and type conversions Appreciate the concepts of inheritance and the various types of inheritance. Understand virtual functions & their need and usage Appreciate the need for manipulators and the design of the same Use the various operations of files to perform file operations Understand the concept of templates.
Specific Objectives: Introduction to OOP Differentiate between procedure oriented and object oriented programming Learn the concepts and benefits of OOPs Appraise the applications of OOPs C++ Additional features Learn C++ keywords, constants, variable declarations and initialization Learn the use of scope resolution operator & memory management operators Learn to use IO Manipulators Write functions to implement call by reference and return by reference Learn the concepts of function overloading Classes and Objects Learn to create objects and access class members Learn to define member function within and outside the class definition Write C++ programs using classes Know about static data members and static functions Know various types of constructors & use of destructor Learn to use objects as function arguments and to return objects from functions Learn to use arrays and strings as class members
Write programs to implement array of objects Learn about friend functions and friend classes Operator Overloading Define operator overloading Learn to overload unary and binary operator Write programs to overload unary and binary operators Write programs to overload binary operator using friend functions Know the rules to be followed while overloading operators Know about various type conversions Inheritance Know the concepts of base class, derived class and derived class constructors Write programs to overload member functions Analyse the concept behind Single Inheritance (public & private) Differentiate between multilevel and multiple inheritance Differentiate between Hierarchical inheritance & hybrid inheritance Write programs to implement all the types of inheritance Learn about Virtual base classes and nesting of classes Write programs to implement virtual classes & nesting of classes Virtual functions Write programs to implement Pointers to objects Know the use of this pointer Write programs to implement Pointers to derived classes Know the concepts of Virtual function & pure virtual function. Implement them Managing Console I/O Operations Understand the concepts of console I/O operations Learn formatted and unformatted console I/O operations Know about Manipulators and implement own manipulators Files Know all the Classes for file stream operations Know all the operations and modes of a file Write programs to implement sequential I/O operations Learn to update a file in random access with error handling function. Templates Know about templates and their uses Implement function templates, member function templates Text Book: OBJECT ORIENTED PROGRAMMING WITH C++, 4E, E BALAGURUSAMY, Tata Mc Graw hill References: 1. Object oriented programming in c++, Dr.G.T. Thampi, Dr. S.s.Matha, Dreamtech, 2009 edition, 2. Object oriented programming in c++, Rajesh K Shukla , Wiely Precise text Book.2008.
3. Object Oriented Programming in Turbo C++ , Robert Lafore. 4. Object Oriented Programming with C++ , Sourav Sahay, Oxford Higher Education 5. C++ Complete Reference, Herbert Schilt. TMH. 6. Programming in C++ , M T Somashekar , PHI 7. Professional C++ , Wiley India (Wrox ) Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering Fourth Semester Subject: OOP with C++ Max. Marks: 100 Model Question Paper Note: 1. Section –I is compulsory. 2. Answer any TWO questions from each remaining Sections. Marks Section – I 1. a) Fill in the blanks with appropriate word/s i. …… is an alias name given to a variable. ii. ……. is a special member function that initializes the data members of a class. iii. The process of deriving one class from more than one base class is called----iv. A ……. Function can accept a value of any type. v. The ------ class provides the functionality for performing read operation from a file. b) Compare POP V/S OOP. Section – II 2. a) Explain the const qualifier . b) Write a c++ program to illustrate an inline function. c) Explain function Overloading with an example 3. a) Define a class. b) Write a program to illustrate constructor overloading. c) Explain the concept of constructor with default arguments. 5 2 8 5 5 5 5 5x1=5 Max. Time: 3 Hours
4. a) What is a friend function? Explain with an example. b) How are static data members declared and defined? Explain. c) What is the significance of operator overloading?
5 6 4
Section – III 5. a) Write a c++ program to add two complex objects by overloading the ‘+ ‘operator. 10 b) What is type conversion? c) What is inheritance? List out the types of Inheritance. 6. a) What is Multiple Inheritance? Write a c++ program to illustrate Multiple Inheritance b) Explain the concept of Nesting of Classes. 7. a) Explain the use of this pointer. b) . Create a base class called 'SHAPE' having two data members of type double member function get-data( ) to initialize base class data members Pure virtual member function display-area ( ) to compute and display the area of the geometrical object. Derive two specific classes 'TRIANGLE' and 'RECTANGLE' from the base class. Using these three classes design a program that will accept dimension of a triangle / rectangle interactively and display the area. Section – IV 8. a) With examples explain unformatted I /O operations. b) Explain the built in monitors in C++ with examples. 9. a) Write a program to illustrate the user defined manipulators with arguments. b) What are the built in classes for a file? Explain. c) What are the different modes to open a file? 10. a) Write a note on command line arguments. b) What is a template? 5 10 5 6 4 5 2 10 5 5 10 2 3
c) Write a program to illustrate class template with multiple parameters.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.