The document discusses object-oriented programming concepts like classes, objects, encapsulation, abstraction, and information hiding. It provides examples of procedural programming versus object-oriented programming. Key topics from the document include defining a C++ class, creating objects from classes, accessing data members of objects, defining member functions within and outside of classes, and the principles of data encapsulation, abstraction, and information hiding in OOP. The document also contrasts procedural, object-oriented, and generic programming techniques.
The document outlines the syllabus for the II Year / III Semester 20IT302 - C++ AND DATA STRUCTURES course. It covers 5 units - (1) Object Oriented Programming Fundamentals, (2) Object Oriented Programming Concepts, (3) C++ Programming Advanced Features, (4) Advanced Non-Linear Data Structures, and (5) Graphs. Some key concepts covered include classes, objects, encapsulation, inheritance, polymorphism, templates, containers, iterators, trees, and graph algorithms.
The document discusses the benefits of object-oriented programming (OOP). It states that OOP offers several benefits to programmers and users, including greater productivity, higher quality software, and lower maintenance costs. It then lists 25 specific advantages of OOP such as code reusability through inheritance, modularity through pre-defined classes, data hiding for security, and easier mapping of real-world problems to code.
The document provides an introduction to object oriented programming (OOP) by comparing it to procedural programming. It discusses that OOP treats data as a critical element and ties data more closely to functions that operate on it. It allows decomposition of problems into objects that contain both data and functions. The four main pillars of OOP are discussed as objects, classes, encapsulation, and inheritance. Classes are defined as collections of similar objects that define attributes and behaviors of objects. Constructors and different types of constructors like parameterized and copy constructors are also introduced.
This document provides an overview of C++ programming concepts including:
- Procedure-oriented programming focuses on tasks like reading, calculating and printing using functions, while object-oriented programming emphasizes data through objects and classes.
- C++ was developed to include object-oriented features while retaining C's simplicity, with classes, inheritance, and other features enabling abstract data types.
- Key concepts covered include classes, objects, member functions, inline functions, passing objects as parameters, returning objects, arrays of objects, and function overloading. Examples are provided to illustrate each concept.
This document provides an overview of C++ programming concepts including:
- Procedure-oriented programming focuses on tasks like reading, calculating and printing using functions, while object-oriented programming emphasizes data through objects and classes.
- Some problems with C include lack of consideration for data elements and lack of security for networks.
- C++ classes contain variables and functions to characterize objects. Data and functions are tied together and data is hidden.
- Key concepts explained include objects, member functions, constructors, destructors, inheritance and polymorphism.
- Examples demonstrate basic C++ programs, classes, objects, arrays of objects, function overloading and the this pointer.
1. The document discusses object oriented programming concepts like classes, objects, inheritance, and polymorphism in C++.
2. It begins with an introduction to procedural programming and its limitations. Object oriented programming aims to overcome these limitations by emphasizing data over procedures and allowing for inheritance, polymorphism, and encapsulation.
3. The document then covers key OOP concepts like classes, objects, constructors, and static class members in C++. It provides examples of creating classes and objects.
This document provides an overview of object-oriented programming (OOP) concepts in C++. It defines key OOP concepts like class, object, inheritance, encapsulation, abstraction, polymorphism, and overloading. It provides examples to illustrate class and object, inheritance with different types, encapsulation by hiding data, and function overloading. The document was prepared by a trainee as part of a mentoring program and provides contact information for the training organization.
The document outlines a lecture plan for object oriented programming. It covers topics like structures and classes, function overloading, constructors and destructors, operator overloading, inheritance, polymorphism, and file streams. It provides examples to explain concepts like structures, classes, access specifiers, friend functions, and operator overloading. The document also includes questions for students to practice these concepts.
The document outlines the syllabus for the II Year / III Semester 20IT302 - C++ AND DATA STRUCTURES course. It covers 5 units - (1) Object Oriented Programming Fundamentals, (2) Object Oriented Programming Concepts, (3) C++ Programming Advanced Features, (4) Advanced Non-Linear Data Structures, and (5) Graphs. Some key concepts covered include classes, objects, encapsulation, inheritance, polymorphism, templates, containers, iterators, trees, and graph algorithms.
The document discusses the benefits of object-oriented programming (OOP). It states that OOP offers several benefits to programmers and users, including greater productivity, higher quality software, and lower maintenance costs. It then lists 25 specific advantages of OOP such as code reusability through inheritance, modularity through pre-defined classes, data hiding for security, and easier mapping of real-world problems to code.
The document provides an introduction to object oriented programming (OOP) by comparing it to procedural programming. It discusses that OOP treats data as a critical element and ties data more closely to functions that operate on it. It allows decomposition of problems into objects that contain both data and functions. The four main pillars of OOP are discussed as objects, classes, encapsulation, and inheritance. Classes are defined as collections of similar objects that define attributes and behaviors of objects. Constructors and different types of constructors like parameterized and copy constructors are also introduced.
This document provides an overview of C++ programming concepts including:
- Procedure-oriented programming focuses on tasks like reading, calculating and printing using functions, while object-oriented programming emphasizes data through objects and classes.
- C++ was developed to include object-oriented features while retaining C's simplicity, with classes, inheritance, and other features enabling abstract data types.
- Key concepts covered include classes, objects, member functions, inline functions, passing objects as parameters, returning objects, arrays of objects, and function overloading. Examples are provided to illustrate each concept.
This document provides an overview of C++ programming concepts including:
- Procedure-oriented programming focuses on tasks like reading, calculating and printing using functions, while object-oriented programming emphasizes data through objects and classes.
- Some problems with C include lack of consideration for data elements and lack of security for networks.
- C++ classes contain variables and functions to characterize objects. Data and functions are tied together and data is hidden.
- Key concepts explained include objects, member functions, constructors, destructors, inheritance and polymorphism.
- Examples demonstrate basic C++ programs, classes, objects, arrays of objects, function overloading and the this pointer.
1. The document discusses object oriented programming concepts like classes, objects, inheritance, and polymorphism in C++.
2. It begins with an introduction to procedural programming and its limitations. Object oriented programming aims to overcome these limitations by emphasizing data over procedures and allowing for inheritance, polymorphism, and encapsulation.
3. The document then covers key OOP concepts like classes, objects, constructors, and static class members in C++. It provides examples of creating classes and objects.
This document provides an overview of object-oriented programming (OOP) concepts in C++. It defines key OOP concepts like class, object, inheritance, encapsulation, abstraction, polymorphism, and overloading. It provides examples to illustrate class and object, inheritance with different types, encapsulation by hiding data, and function overloading. The document was prepared by a trainee as part of a mentoring program and provides contact information for the training organization.
The document outlines a lecture plan for object oriented programming. It covers topics like structures and classes, function overloading, constructors and destructors, operator overloading, inheritance, polymorphism, and file streams. It provides examples to explain concepts like structures, classes, access specifiers, friend functions, and operator overloading. The document also includes questions for students to practice these concepts.
This document provides an overview of C++ programming concepts. It introduces C++, focusing on programming concepts and design techniques rather than technical language details. It discusses procedural and object-oriented programming concepts, and how C++ supports both as well as generic programming. The key characteristics of object-oriented programming languages are explained as encapsulation, inheritance, and polymorphism.
This document provides an overview of C++ programming concepts. It introduces C++, focusing on programming concepts and design techniques rather than technical language details. It discusses procedural and object-oriented programming concepts, and how C++ supports both as well as generic programming. The key characteristics of object-oriented programming languages are explained as encapsulation, inheritance, and polymorphism.
This document provides an overview of object-oriented programming (OOP) concepts in C#, including classes, objects, inheritance, encapsulation, and polymorphism. It defines key terms like class and object, and explains how C# supports OOP principles such as defining classes with methods and properties, extending classes through inheritance, hiding implementation through encapsulation, and allowing polymorphic behavior through function overloading and overriding. Abstract classes and sealed modifiers are also covered. The document is intended to help explain basic OOP concepts in C# to readers.
This document provides information about a class on Object Oriented Programming (OOP) with C++ taught by Venkatadri.M, an Assistant Professor at the University of Petroleum and Energy Studies in Dehradun, India. The class covers the evolution of OOP, the history of C++, organizing data and functions in OOP, features of object oriented languages, and polymorphism. The instructor uses diagrams, animations and PowerPoint presentations to teach the concepts and address frequently asked questions from students.
This document provides an overview of object-oriented programming concepts in Dart including classes and objects, constructors, encapsulation, inheritance, polymorphism, asynchronous programming using futures and async/await, and exception handling using try/catch. It defines key OOP terms, shows code examples for defining classes and objects, using constructors to initialize objects, encapsulating data with private properties and public getters/setters, inheriting properties from a parent class, allowing objects to take different forms with polymorphism, performing asynchronous tasks with futures, and handling errors with try/catch blocks.
Classes and Objects
Classes in C++
Declaring Objects
Access Specifiers and their Scope
Defining Member Function
Overloading Member Function
Nested class
Constructors and Destructors
Introduction
Characteristics of Constructor and Destructor
Application with Constructor
Constructor with Arguments (parameterized Constructors)
Destructors
This document provides an overview of object-oriented programming (OOP) concepts in C++ including objects, classes, abstraction, encapsulation, inheritance, and polymorphism. It defines each concept, provides examples in C++ code, and explains how they allow code reuse and flexibility through bundling of data and functions into objects that can be specialized into different forms. The document is intended to introduce the core OOP principles in C++ for educational purposes as part of a mentoring program.
This document discusses object-oriented programming (OOP) concepts in Java such as classes, objects, inheritance, encapsulation, abstraction, and polymorphism. It defines OOP as a programming paradigm that uses classes and objects. Key concepts covered include how objects represent real-world entities with variables and methods, how classes define object types, and how inheritance, encapsulation, and polymorphism are implemented in Java. Examples are provided to illustrate constructor, inheritance, and polymorphism.
The document discusses fundamentals of object-oriented programming. It defines objects as software bundles that model real-world objects using variables to represent states and methods to represent behaviors. Classes are blueprints that define common variables and methods for objects. Objects interact by sending messages to each other specifying a method and parameters. Object-oriented principles of abstraction, encapsulation, inheritance and polymorphism are covered.
This document provides an overview of object-oriented programming (OOP) and C++. It discusses key concepts in OOP like classes, objects, inheritance, polymorphism and encapsulation. It then covers the history and development of OOP languages, with Simula 67 being an early language. C++ is presented as building on C with object-oriented features. The document defines common C++ elements like data types, operators, streams and functions. It provides examples of C++ programs and concepts like structures, call by reference, and function overloading.
Objective-C for iOS Application DevelopmentDhaval Kaneria
The document provides an introduction to Objective-C and iPhone development. It discusses key aspects of Objective-C including its syntax which extends C with object-oriented capabilities. Objective-C uses class definitions with interfaces and implementations. Programs create class instances that can receive messages to call methods. Classes can inherit from superclasses and support polymorphism. The document also outlines core concepts like memory management, frameworks for iOS development and examples of Hello World programs.
The sole purpose of sharing these slides are to educate the beginners of IT and Computer Science/Engineering. Credits should go to the referred material and also CICRA campus, Colombo 4, Sri Lanka where I taught these in 2017.
This document summarizes a mentee's progress in their typing skills and learning of object-oriented programming concepts over 10 weeks. It shows that the mentee's typing speed improved from 18WPM to 23WPM but did not reach the weekly target of 25WPM. It then explains key OOP concepts like classes, objects, constructors, abstraction, encapsulation, polymorphism, and inheritance. It provides examples to illustrate these concepts. The document was prepared by trainees of Baabtra as part of their mentoring program.
This document provides an introduction to C and C++ programming. It discusses why C++ is a popular and relevant language, highlighting some of its key advantages over C like being more expressive and maintainable. It covers important C++ concepts like classes, inheritance, templates, and the standard template library. The document emphasizes designing classes for simplicity and elegance and using object-oriented principles like encapsulation and polymorphism. It also contrasts C++ programming paradigms like procedural, object-oriented, and generic programming.
This document provides an introduction to classes in C++, including constructors, destructors, class members, inheritance, and errors. It defines a class called MyCoordinate with members like x, y, and an array. It discusses using constructors to initialize members and destructors to clean up memory. The document also covers defining classes with public and private members and inheriting from parent classes.
Introduction to C++
Difference between C and C++
Evolution of C++
Procedure Oriented Programming vs Object OrientedProgramming
Key concepts of Object-Oriented Programming
Advantages and Disadvantages of OOP
This document provides a lab manual for the fourth semester computer science engineering course on Object Oriented Technology. It includes the syllabus, rationale for object oriented programming, hardware and software requirements, a list of practical experiments to be conducted, and sample code for some of the experiments. The experiments cover topics like function overloading, inheritance, polymorphism, constructors, destructors, copy constructors, friend functions, and use of local, static and global objects. Each experiment is followed by sample output and questions related to the concepts covered in the program. The document aims to provide guidance to students on the practical implementation of object oriented programming concepts using C++.
This document discusses object-oriented programming and C++. It introduces classes and objects, explaining that classes are user-defined data types that contain data members and member functions, while objects are instances of classes. It provides examples of defining a class called Student and creating objects from it. The document also covers abstract data types and the advantages of abstraction.
The document discusses key concepts in object-oriented programming including classes, objects, data encapsulation, inheritance, and polymorphism. It defines a class as a blueprint for objects that describes their properties and behaviors. An object is an instance of a class. Classes contain data members and member functions. Data hiding is achieved through declaring data members as private while member functions can be public or private. The document also discusses constructors, destructors, operator overloading, inheritance and polymorphism.
The document discusses data warehousing and online analytical processing (OLAP). It covers topics like data warehouse modeling, design, implementation, usage, and efficient processing of OLAP queries. Attribute-oriented induction for data generalization is also introduced, which allows interactive exploration of generalized data relationships through operations like drilling and pivoting. The key aspects and techniques involved in building and analyzing data warehouses are summarized.
The document discusses various aspects of application layer protocols. It begins with an overview of the protocol stack and how application data passes through different layers. It then describes several important application layer protocols - Domain Name System (DNS) for name resolution, Hypertext Transfer Protocol (HTTP) for the web, Simple Mail Transfer Protocol (SMTP) for email transmission, Post Office Protocol version 3 (POP3) and Internet Message Access Protocol version 4 (IMAP4) for email delivery, and File Transfer Protocol (FTP) for file transfer. For each protocol, the document explains their basic architecture, message formats, and mechanisms of data transfer.
Human: Thank you for the summary. Can you provide a more concise summary in 2 sentences
This document provides an overview of C++ programming concepts. It introduces C++, focusing on programming concepts and design techniques rather than technical language details. It discusses procedural and object-oriented programming concepts, and how C++ supports both as well as generic programming. The key characteristics of object-oriented programming languages are explained as encapsulation, inheritance, and polymorphism.
This document provides an overview of C++ programming concepts. It introduces C++, focusing on programming concepts and design techniques rather than technical language details. It discusses procedural and object-oriented programming concepts, and how C++ supports both as well as generic programming. The key characteristics of object-oriented programming languages are explained as encapsulation, inheritance, and polymorphism.
This document provides an overview of object-oriented programming (OOP) concepts in C#, including classes, objects, inheritance, encapsulation, and polymorphism. It defines key terms like class and object, and explains how C# supports OOP principles such as defining classes with methods and properties, extending classes through inheritance, hiding implementation through encapsulation, and allowing polymorphic behavior through function overloading and overriding. Abstract classes and sealed modifiers are also covered. The document is intended to help explain basic OOP concepts in C# to readers.
This document provides information about a class on Object Oriented Programming (OOP) with C++ taught by Venkatadri.M, an Assistant Professor at the University of Petroleum and Energy Studies in Dehradun, India. The class covers the evolution of OOP, the history of C++, organizing data and functions in OOP, features of object oriented languages, and polymorphism. The instructor uses diagrams, animations and PowerPoint presentations to teach the concepts and address frequently asked questions from students.
This document provides an overview of object-oriented programming concepts in Dart including classes and objects, constructors, encapsulation, inheritance, polymorphism, asynchronous programming using futures and async/await, and exception handling using try/catch. It defines key OOP terms, shows code examples for defining classes and objects, using constructors to initialize objects, encapsulating data with private properties and public getters/setters, inheriting properties from a parent class, allowing objects to take different forms with polymorphism, performing asynchronous tasks with futures, and handling errors with try/catch blocks.
Classes and Objects
Classes in C++
Declaring Objects
Access Specifiers and their Scope
Defining Member Function
Overloading Member Function
Nested class
Constructors and Destructors
Introduction
Characteristics of Constructor and Destructor
Application with Constructor
Constructor with Arguments (parameterized Constructors)
Destructors
This document provides an overview of object-oriented programming (OOP) concepts in C++ including objects, classes, abstraction, encapsulation, inheritance, and polymorphism. It defines each concept, provides examples in C++ code, and explains how they allow code reuse and flexibility through bundling of data and functions into objects that can be specialized into different forms. The document is intended to introduce the core OOP principles in C++ for educational purposes as part of a mentoring program.
This document discusses object-oriented programming (OOP) concepts in Java such as classes, objects, inheritance, encapsulation, abstraction, and polymorphism. It defines OOP as a programming paradigm that uses classes and objects. Key concepts covered include how objects represent real-world entities with variables and methods, how classes define object types, and how inheritance, encapsulation, and polymorphism are implemented in Java. Examples are provided to illustrate constructor, inheritance, and polymorphism.
The document discusses fundamentals of object-oriented programming. It defines objects as software bundles that model real-world objects using variables to represent states and methods to represent behaviors. Classes are blueprints that define common variables and methods for objects. Objects interact by sending messages to each other specifying a method and parameters. Object-oriented principles of abstraction, encapsulation, inheritance and polymorphism are covered.
This document provides an overview of object-oriented programming (OOP) and C++. It discusses key concepts in OOP like classes, objects, inheritance, polymorphism and encapsulation. It then covers the history and development of OOP languages, with Simula 67 being an early language. C++ is presented as building on C with object-oriented features. The document defines common C++ elements like data types, operators, streams and functions. It provides examples of C++ programs and concepts like structures, call by reference, and function overloading.
Objective-C for iOS Application DevelopmentDhaval Kaneria
The document provides an introduction to Objective-C and iPhone development. It discusses key aspects of Objective-C including its syntax which extends C with object-oriented capabilities. Objective-C uses class definitions with interfaces and implementations. Programs create class instances that can receive messages to call methods. Classes can inherit from superclasses and support polymorphism. The document also outlines core concepts like memory management, frameworks for iOS development and examples of Hello World programs.
The sole purpose of sharing these slides are to educate the beginners of IT and Computer Science/Engineering. Credits should go to the referred material and also CICRA campus, Colombo 4, Sri Lanka where I taught these in 2017.
This document summarizes a mentee's progress in their typing skills and learning of object-oriented programming concepts over 10 weeks. It shows that the mentee's typing speed improved from 18WPM to 23WPM but did not reach the weekly target of 25WPM. It then explains key OOP concepts like classes, objects, constructors, abstraction, encapsulation, polymorphism, and inheritance. It provides examples to illustrate these concepts. The document was prepared by trainees of Baabtra as part of their mentoring program.
This document provides an introduction to C and C++ programming. It discusses why C++ is a popular and relevant language, highlighting some of its key advantages over C like being more expressive and maintainable. It covers important C++ concepts like classes, inheritance, templates, and the standard template library. The document emphasizes designing classes for simplicity and elegance and using object-oriented principles like encapsulation and polymorphism. It also contrasts C++ programming paradigms like procedural, object-oriented, and generic programming.
This document provides an introduction to classes in C++, including constructors, destructors, class members, inheritance, and errors. It defines a class called MyCoordinate with members like x, y, and an array. It discusses using constructors to initialize members and destructors to clean up memory. The document also covers defining classes with public and private members and inheriting from parent classes.
Introduction to C++
Difference between C and C++
Evolution of C++
Procedure Oriented Programming vs Object OrientedProgramming
Key concepts of Object-Oriented Programming
Advantages and Disadvantages of OOP
This document provides a lab manual for the fourth semester computer science engineering course on Object Oriented Technology. It includes the syllabus, rationale for object oriented programming, hardware and software requirements, a list of practical experiments to be conducted, and sample code for some of the experiments. The experiments cover topics like function overloading, inheritance, polymorphism, constructors, destructors, copy constructors, friend functions, and use of local, static and global objects. Each experiment is followed by sample output and questions related to the concepts covered in the program. The document aims to provide guidance to students on the practical implementation of object oriented programming concepts using C++.
This document discusses object-oriented programming and C++. It introduces classes and objects, explaining that classes are user-defined data types that contain data members and member functions, while objects are instances of classes. It provides examples of defining a class called Student and creating objects from it. The document also covers abstract data types and the advantages of abstraction.
The document discusses key concepts in object-oriented programming including classes, objects, data encapsulation, inheritance, and polymorphism. It defines a class as a blueprint for objects that describes their properties and behaviors. An object is an instance of a class. Classes contain data members and member functions. Data hiding is achieved through declaring data members as private while member functions can be public or private. The document also discusses constructors, destructors, operator overloading, inheritance and polymorphism.
The document discusses data warehousing and online analytical processing (OLAP). It covers topics like data warehouse modeling, design, implementation, usage, and efficient processing of OLAP queries. Attribute-oriented induction for data generalization is also introduced, which allows interactive exploration of generalized data relationships through operations like drilling and pivoting. The key aspects and techniques involved in building and analyzing data warehouses are summarized.
The document discusses various aspects of application layer protocols. It begins with an overview of the protocol stack and how application data passes through different layers. It then describes several important application layer protocols - Domain Name System (DNS) for name resolution, Hypertext Transfer Protocol (HTTP) for the web, Simple Mail Transfer Protocol (SMTP) for email transmission, Post Office Protocol version 3 (POP3) and Internet Message Access Protocol version 4 (IMAP4) for email delivery, and File Transfer Protocol (FTP) for file transfer. For each protocol, the document explains their basic architecture, message formats, and mechanisms of data transfer.
Human: Thank you for the summary. Can you provide a more concise summary in 2 sentences
The document appears to be a list of candidates who have scored 100/100 or near 100/100 on an exam from various colleges in India. It includes the candidate's name, college, and score. There are over 100 entries in the list with candidates from colleges all over India, primarily from the state of Karnataka. The majority of candidates scored 100/100 but some scored 98/100 or 96/100.
The document discusses the data link layer and its responsibilities. Specifically:
1) The data link layer transforms the physical layer into a link responsible for node-to-node communication. It is responsible for framing, addressing, flow control, error control, and media access control.
2) It provides services to the network layer like transferring data packets between network layers on different machines and offering various service models like unacknowledged connectionless, acknowledged connectionless, and acknowledged connection-oriented.
3) Key data link layer protocols are discussed including framing, error detection using CRC, flow control, and elementary protocol examples like unrestricted simplex and stop-and-wait.
Analog and digital data and signals are discussed. Analog data and signals are continuous while digital data and signals are discrete. Periodic analog signals like sine waves are examined. Digital signals can be represented as composite analog signals. For transmission, digital signals must be converted to analog signals if the channel is bandpass. Transmission is impaired by attenuation, distortion, and noise.
This document discusses different methods for digital-to-analog conversion including amplitude shift keying (ASK), frequency shift keying (FSK), phase shift keying (PSK), and quadrature amplitude modulation (QAM). ASK encodes digital data by changing the amplitude of an analog carrier signal. FSK encodes by changing the frequency of the carrier signal. PSK encodes by changing the phase of the carrier signal. QAM encodes multiple bits onto a signal by using two carrier signals that are 90 degrees out of phase. The document provides examples and diagrams to illustrate how each encoding method works.
This document provides an overview of the Database Management Systems -20ISE43A course. It lists the required textbooks and references. It then outlines the 5 modules that will be covered in the course: introduction to databases, entity relationship diagrams, the relational model, relational algebra, and advanced SQL and transaction management. The document also lists the course outcomes and provides brief descriptions of some of the key topics that will be covered, including embedded SQL, dynamic SQL, database stored procedures, transaction concepts, and concurrency issues.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
2. CONTENTS OF UNIT - I
• Introduction to procedural, modular, object-oriented and generic
programming techniques
• Limitations of procedural programming
• Need of object-oriented programming
• Object Oriented Programming features
● Objects
● Classes & Class as ADT
● Data members
● Methods
● Message passing
● Data encapsulation
● Data abstraction
● Information hiding
● Inheritance(Code Reuse)
● Polymorphism(Function overloading and operator overloading)
2
Pro.
R.
G.
Masand,
VIIT,
Pune
3. FUNDAMENTALS OF OO
PROGRAMMING
• C++ Program Structure
• C++ Identifiers
• C++ Keywords
• Comments
• Primitive Built- in Types
• Variable declarations
• Local scope v/s Global Scope
• Literals
• Const keyword
3
Pro.
R.
G.
Masand,
VIIT,
Pune
4. FUNDAMENTALS OF OO
PROGRAMMING(CONTINUED)
• Defining Function & Function Prototyping
• Function Declaration
• Function Calling
• Inline Function
• Pointers
• This pointer
• C++ References
• Standard INPUT & OUTPUT Streams
• Class Constructor & Destructor
• Static Keyword
• Static data members
• Static member function
• Dynamic memory Allocation & De-allocation
• New & Delete operator
• I/O manipulation
4
Pro.
R.
G.
Masand,
VIIT,
Pune
5. A SURVEY OF PROGRAMMING
TECHNIQUES
• Unstructured programming
• Procedural programming
• Modular programming
• Object-oriented programming
• Generic programming
5
Pro.
R.
G.
Masand,
VIIT,
Pune
6. UNSTRUCTURED PROGRAMMING
• Only one Program i.e. main Program
• All the sequences of commands or statements in one
programs called main Program
• E.g. Fortran, assembly language, old Basic
6
Pro.
R.
G.
Masand,
VIIT,
Pune
7. STRUCTURED PROGRAMMING
• Also called as Procedural Programming
• For each task procedure is created
• The procedures are called from main
7
Pro.
R.
G.
Masand,
VIIT,
Pune
8. MODULAR PROGRAMMING
• Procedures with some common functionality
are grouped together into separate modules
• Program is categorized into several smaller
modules
• Each module can have its own data
8
Pro.
R.
G.
Masand,
VIIT,
Pune
9. OBJECT-ORIENTED PROGRAMMING
• Works on objects which is considered smallest
unit of the object oriented languages
• Focuses more on data rather than Procedures
9
Pro.
R.
G.
Masand,
VIIT,
Pune
10. EXAMPLE
• Unstructured Programming:
#include
#include
void main()
{
int a,b,c;
clrscr();
cout << "Enter the first number";
cin >> a;
cout << "Enter the second number";
cin >> b;
c=a+b;
cout << "The sum is:" << c;
getch();
} 10
Pro.
R.
G.
Masand,
VIIT,
Pune
11. EXAMPLE
• Procedural Programming:
#include
#include
int add(int,int);
void main()
{
int a,b,c;
clrscr();
cout << "Enter the first number";
cin >> a;
cout << "Enter the second number";
cin >> b;
c=add(a,b);
cout<<"The sum is:" << c;
getch();
}
int add(int x,int y)
{
int z=x+y;
return z;
}
11
Pro.
R.
G.
Masand,
VIIT,
Pune
12. EXAMPLE
• Object Oriented programming
#include
#include
class Addition
{
int a,b,c;
public:
void read()
{
cin >> a;
cin >> b;
}
void add()
{
c=a+b;
}
void display()
{
cout << "The sum is:" << c;
}
};
void main()
{
Addition obj; //object creation
cout << "Enter the numbers";
obj.read();
obj.add();
obj.display();
getch();
}
12
Pro.
R.
G.
Masand,
VIIT,
Pune
13. LIMITATIONS OF PROCEDURAL PROGRAMMING
• Poor real world model.
• No importance to data.
• No privacy.
• No true reuse.
• Functions and data should be treated
equally.
13
Pro.
R.
G.
Masand,
VIIT,
Pune
15. Feature Procedure oriented Programming Object oriented Programming
Divided Into
In POP Program is divided into small parts
called functions
In OOP, program is divided into parts
called objects.
Importance In POP, Importance is not given to data
but to functions as well as sequence of
actions to be done.
In OOP, Importance is given to the data
rather than procedures or functions
because it works as a real world.
Approach POP follows Top Down approach. OOP follows Bottom Up approach
Access Specifiers POP does not have any access specifier OOP has access specifiers named
Public, Private, Protected, etc.
Data Moving In POP, Data can move freely from
function to function in the system.
In OOP, objects can move and
communicate with each other through
member functions.
Expansion To add new data and function in POP is
not so easy.
OOP provides an easy way to add new
data and function
Data Access
In POP, Most function uses Global data
for sharing that can be accessed freely
from function to function in the system.
In OOP, data can not move easily from
function to function, it can be kept public
or private so we can control the access of
data.
Data Hiding
POP does not have any proper way for
hiding data so it is less secure.
OOP provides Data Hiding so provides
more security.
Overloading In POP, Overloading is not possible. In OOP, overloading is possible in the
form of Function Overloading and
Operator Overloading.
Examples Example of POP are : C, VB,
FORTRAN, Pascal.
Example of OOP are : C++, JAVA,
VB.NET, C#.NET.
15
Pro.
R.
G.
Masand,
VIIT,
Pune
16. GENERIC PROGRAMMING
• It is an idea that code should be as generic as
possible
• Means writing templates
• e.g. container classes like arrays
16
Pro.
R.
G.
Masand,
VIIT,
Pune
18. INTRODUCTION
• C++ is a statically typed, compiled, general-
purpose, case-sensitive, free-form programming
language that supports procedural, object-
oriented, and generic programming.
• C++ is regarded as a middle-level language, as it
comprises a combination of both high-level and
low-level language features
• Developed by Bjarne Stroustrup starting in 1979
at Bell Labs in Murray Hill, New Jersey
18
Pro.
R.
G.
Masand,
VIIT,
Pune
19. C++ CLASS DEFINITION
• It is template, format or blueprint
• Also can be said as user defined data Type
• A class definition starts with the keyword class
followed by the class name; and the class body,
enclosed by a pair of curly braces.
• Class definition must be followed by a semicolon
• Class contains data members and member function
class Box{
public:
double length; // Length of a box
double breadth; // Breadth of a box
double height; // Height of a box
}; 19
Pro.
R.
G.
Masand,
VIIT,
Pune
20. CLASS AS ADT
• Abstract Data Types (ADTs)
● type implementation & operations
● hidden implementation
• built-in and user-defined types are ADTs
client
Implementation
Interface
manufacturer’s
responsibility
ADT
use
client
client
20
Pro.
R.
G.
Masand,
VIIT,
Pune
21. C++ OBJECTS
• A class provides the blueprints for objects
• an object is created from a class
• Object is variable of class type
• Objects are declared the same way the variables
are declared
Box Box1; // Declare Box1 of type Box
Box Box2; // Declare Box2 of type Box
Both of the objects Box1 and Box2 will have their
own
copy of data members.
21
Pro.
R.
G.
Masand,
VIIT,
Pune
22. ACCESSING THE DATA MEMBERS
• The public data members of objects of a class can be
accessed using the direct member access operator (.)
#include <iostream>
using namespace std;
class Box{
public:
double length; // Length of a
box double breadth; // Breadth of a
box double height; // Height of a
box
};int main( ){
Box Box1; // Declare Box1 of type
Box Box Box2; // Declare Box2 of
type Box double volume = 0.0; //
Store the volume of a box here
// box 1 specification Box1.height = 5.0;
Box1.length = 6.0;
Box1.breadth = 7.0;
// box 2 specification
Box2.height = 10.0;
Box2.length = 12.0;
Box2.breadth = 13.0; //
volume of //box 1
volume = Box1.height *
Box1.length * Box1.breadth;
cout << "Volume of Box1 : " <<
volume <<endl; // volume of
box 2
volume = Box2.height *
Box2.length * Box2.breadth;
cout << "Volume of Box2 : " <<
volume <<endl; return 0;}
22
Pro.
R.
G.
Masand,
VIIT,
Pune
23. MEMBERS OF CLASS
• A member function of a class is a function that has
its definition or its prototype within the class
• Members are accessed using dot operator(.)
class Box
{
public:
double length; // Length of a box
double breadth; // Breadth of a box data
member double height; // Height of a
box
double getVolume(void); // Returns box
volume
// member function
};
23
Pro.
R.
G.
Masand,
VIIT,
Pune
24. MEMBERS OF CLASS(CONTINUED…)
• Member functions can be defined within the class
definition or separately using scope resolution
operator, ::
class Box{
public:
double length; // Length of a box
double breadth; // Breadth of a box
double height; // Height of a box
double getVolume(void){
return length * breadth * height;
}
};// class end
24
Pro.
R.
G.
Masand,
VIIT,
Pune
25. MEMBERS OF CLASS(CONTINUED…)
• If you like you can define same function outside
the class using scope resolution operator, :: as
follows:
double Box::getVolume(void){
return length * breadth * height;
}
25
Pro.
R.
G.
Masand,
VIIT,
Pune
26. DATA ENCAPSULATION
• The wrapping up of data and function into a single
unit (called class) is known as encapsulation. Data
and encapsulation is the most striking feature of a
class.
• OOP encapsulates data (attributes) and functions
(behavior) into packages called objects
• E.g. class encapsulates data members and member
functions
26
Pro.
R.
G.
Masand,
VIIT,
Pune
27. DATA ABSTRACTION
• Abstraction refers to the act of representing
essential features without including the
background details or explanation
• Classes use the concept of abstraction and are
defined as a list of abstract attributes such as size,
wait, and cost, and function operate on these
attributes.
• E.g TV
● a television separates its internal implementation from
its external interface and we can play with its interfaces
like the power button, channel changer, and volume
control without having any knowledge of its internals.
27
Pro.
R.
G.
Masand,
VIIT,
Pune
28. INFORMATION HIDING
• Data hiding is one of the important features of
Object Oriented Programming which allows
preventing the functions of a program to access
directly the internal representation of a class type
• The access restriction to the class members is
specified by the labeled public, private, and
protected sections within the class body
• private, and protected are called access
specifiers/modifiers.
• A class can have multiple public, protected, or
private labeled sections
• The default access for members and classes is
private 28
Pro.
R.
G.
Masand,
VIIT,
Pune
29. INFORMATION HIDING(CONTINUED)
• class Base {
public: // public members go here
protected: // protected members go here
private: // private members go here
};
29
Pro.
R.
G.
Masand,
VIIT,
Pune
30. INFORMATION HIDING(CONTINUED)
• A public member is accessible from anywhere
outside the class but within a program
• A private member variable or function cannot be
accessed, or even viewed from outside the class.
Only the class and friend functions can access
private members.
• By default all the members of a class would be
private
• A protected member variable or function is very
similar to a private member but it provided one
additional benefit that they can be accessed in
child classes which are called derived classes
30
Pro.
R.
G.
Masand,
VIIT,
Pune
31. INHERITANCE
• Inheritance is the process by which objects of one
class acquired the properties of objects of another
classes.
• In OOP, the concept of inheritance provides the
idea of reusability
• add additional features to an existing class without
modifying it
31
Pro.
R.
G.
Masand,
VIIT,
Pune
32. POLYMORPHISM
• Polymorphism is another important OOP concept.
Polymorphism, a Greek term, means the ability to
take more than on form
• An operation may exhibit different behavior is
different instances.
• The process of making an operator to exhibit
different behaviors in different instances is known
as operator overloading.
• Using a single function name to perform different
type of task is known as function overloading.
• E.g. abs(parameter type) instead of fabs(),labs(),abs()
32
Pro.
R.
G.
Masand,
VIIT,
Pune
33. MESSAGE PASSING
• An object-oriented program consists of a set of
objects that communicate with each other. The
process of programming in an object-oriented
language, involves the following basic steps:
● Creating classes that define object and their behaviour,
● Creating objects from class definitions, and
● Establishing communication among objects.
• A Message for an object is a request for execution
of a procedure, and therefore will invoke a
function (procedure) in the receiving object that
generates the desired results.
• Message passing involves specifying the name of
object, the name of the function (message) and the
information to be sent. Example:
33
Pro.
R.
G.
Masand,
VIIT,
Pune
35. USE OF C++
• C++ is used by hundreds of thousands of
programmers in essentially every application
domain.
• C++ is being highly used to write device drivers
and other softwares that rely on direct
manipulation of hardware under real-time
constraints.
• C++ is widely used for teaching and research
because it is clean enough for successful teaching
of basic concepts.
• Anyone who has used either an Apple Macintosh
or a PC running Windows has indirectly used
C++ because the primary user interfaces of these
systems are written in C++.
35
Pro.
R.
G.
Masand,
VIIT,
Pune
36. C++ PROGRAM STRUCTURE
#include <iostream>// headers
using namespace std; // use std namespace
// main() is where program execution begins.
int main()
{
cout << "Hello World"; // prints Hello
World// //
statements
return 0;
}
36
Pro.
R.
G.
Masand,
VIIT,
Pune
37. C++ IDENTIFIER
• A C++ identifier is a name used to identify a
variable, function, class, module, or any other
user-defined item.
• Starts with a letter A to Z or a to z or an
underscore (_) followed by zero or more letters,
underscores, and digits (0 to 9).
• C++ does not allow punctuation characters such as
@, $, and % within identifiers
• C++ is a case-sensitive programming language
• E.g. Mohd, zara, abc, move_name, a_123
myname50, _temp, j, a23b9, retVal 37
Pro.
R.
G.
Masand,
VIIT,
Pune
39. COMMENTS
• Program comments are explanatory statements
that you can include in the C++ code that you write
and helps anyone reading it's source code
• All programming languages allow for some form of
comments.
• C++ supports single-line and multi-line comments
• C++ comments start with /* and end with */.
• /* This is a comment */
• /*
C++ comments can also
* span multiple lines
*/
• // prints Hello World ---single line comment
39
Pro.
R.
G.
Masand,
VIIT,
Pune
42. DATA TYPE PROGRAM
• #include <iostream>
• using namespace std;
• int main(){
cout << "Size of char : " << sizeof(char) << endl;
cout << "Size of int : " << sizeof(int) << endl;
cout << "Size of short int : " << sizeof(short int) << endl;
cout << "Size of long int : " << sizeof(long int) << endl;
cout << "Size of float : " << sizeof(float) << endl;
cout << "Size of double : " << sizeof(double) << endl;
cout << "Size of wchar_t : " << sizeof(wchar_t) << endl;
return 0;
}
// endl, which inserts a new-line character after
every line
42
Pro.
R.
G.
Masand,
VIIT,
Pune
43. VARIABLES DEFINITION IN C++
• A variable definition means to tell the compiler where and how much to create the
storage for the variable
type variable_list;
• Example
#include <iostream>
using namespace std;
// Variable declaration:
extern int a, b;
extern int c;
extern float f;
int main (){
// Variable definition:
int a, b, c;
float f;
// actual initialization
a = 10;
b = 20;
c = a + b;
cout << c << endl ;
f = 70.0/3.0;
cout << f << endl ;
return 0;
43
Pro.
R.
G.
Masand,
VIIT,
Pune
44. VARIABLES
• In all programming languages, we need to use
various variables to store various information
• are nothing but reserved memory locations to store
values
• to store information of various data types like
character, wide character, integer, floating point,
double floating point, Boolean etc.
• Based on the data type of a variable, the operating
system allocates memory and decides what can be
stored in the reserved memory.
• Variable provides us with named storage that our
programs can manipulate.
• The name of a variable can be composed of letters,
digits, and the underscore character.
44
Pro.
R.
G.
Masand,
VIIT,
Pune
45. TYPES OF VARIABLE IN C++
Type Description
bool Stores either value true or false.
char
Typically a single octet(one byte). This is an
integer type.
int
The most natural size of integer for the
machine.
float A single-precision floating point value.
double A double-precision floating point value.
void Represents the absence of type.
wchar_t A wide character type.
45
Pro.
R.
G.
Masand,
VIIT,
Pune
46. LOCAL AND GLOBAL VARIABLES
• Local Variable
● Variables that are declared inside a function or block are local
variables.
● They can be used only by statements that are inside that function
or block of code.
● Local variables are not known to functions outside their own
#include <iostream>
using namespace std;
int main ()
{
// Local variable declaration:
int a, b;
int c;
// actual initialization
a = 10;
b = 20;
c = a + b;
cout << c;
return 0;
}
46
Pro.
R.
G.
Masand,
VIIT,
Pune
47. • Global Variables
● Global variables are defined outside of all the
functions, usually on top of the program
● The global variables will hold their value throughout
the life-time of your program.
● A global variable can be accessed by any function
● Global variable is available for use throughout your
entire program after its declaration
47
Pro.
R.
G.
Masand,
VIIT,
Pune
48. GLOBAL VARIABLES : EXAMPLE
#include <iostream>
using namespace std;
// Global variable declaration:
int g = 20;
int main ()
{
// Local variable declaration:
int g = 10;
cout << g;
return 0;
}
48
Pro.
R.
G.
Masand,
VIIT,
Pune
49. LITERALS
• Constants refer to fixed values that the program
may not alter and they are called literals.
• Constants can be of any of the basic data types and
can be divided into Integer Numerals, Floating-
Point Numerals, Characters, Strings and Boolean
Values.
• constants are treated just like regular variables
except that their values cannot be modified after
their definition
49
Pro.
R.
G.
Masand,
VIIT,
Pune
50. INTEGER LITERAL
• An integer literal can be a decimal, octal, or
hexadecimal constant.
• A prefix specifies the base or radix: 0x or 0X for
hexadecimal, 0 for octal, and nothing for decimal.
• An integer literal can also have a suffix that is a
combination of U and L, for unsigned and long,
respectively.
• The suffix can be uppercase or lowercase and can
be in any order
50
Pro.
R.
G.
Masand,
VIIT,
Pune
51. EXAMPLES
212 // Legal
215u // Legal
0xFeeL // Legal
078 // Illegal: 8 is not an octal digit
032UU // Illegal: cannot repeat a suffix
85 // decimal
0213 // octal
0x4b // hexadecimal
30 // int
30u // unsigned int
30l // long
30ul // unsigned long
51
Pro.
R.
G.
Masand,
VIIT,
Pune
52. FLOATING POINT LITERALS
• A floating-point literal has an integer part, a
decimal point, a fractional part, and an exponent
part
3.14159 // Legal
314159E-5L // Legal
510E // Illegal: incomplete exponent
210f // Illegal: no decimal or
exponent
.e55 // Illegal: missing integer or
fraction
52
Pro.
R.
G.
Masand,
VIIT,
Pune
53. BOOLEAN LITERAL
• There are two Boolean literals and they are part of
standard C++ keywords:
● A value of true representing true.
● A value of false representing false
53
Pro.
R.
G.
Masand,
VIIT,
Pune
54. CHARACTER LITERALS
• Character literals are enclosed in single quotes
• If the literal begins with L (uppercase only), it is a
wide character literal (e.g., L'x') and should be
stored in wchar_t type of variable
• it is a narrow character literal (e.g., 'x') and can be
stored in a simple variable of char type
• A character literal can be a plain character (e.g., 'x'),
an escape sequence (e.g., 't'), or a universal
character (e.g., 'u02C0').
54
Pro.
R.
G.
Masand,
VIIT,
Pune
55. ESCAPE SEQUENCES
Escape sequence Meaning
character
' ' character
" " character
? ? character
a Alert or bell
b Backspace
f Form feed
n Newline
r Carriage return
t Horizontal tab
v Vertical tab
ooo
Octal number of one to three
digits
xhh . . .
Hexadecimal number of one or
more digits
55
Pro.
R.
G.
Masand,
VIIT,
Pune
56. STRING LITERALS
• String literals are enclosed in double quotes
• A string contains characters that are similar to
character literals: plain characters, escape
sequences, and universal characters
• "hello, dear“
• "hello,
dear“
• "hello, " "d" "ear"
56
Pro.
R.
G.
Masand,
VIIT,
Pune
57. CONST KEYWORD
• use const prefix to declare constants with a specific type as
follows:
const type variable = value;
#include <iostream>
using namespace std;
int main()
• {
const int LENGTH = 10;
const int WIDTH = 5;
const char NEWLINE = 'n';
int area;
area = LENGTH * WIDTH;
cout << area;
cout << NEWLINE;
return 0;
}
57
Pro.
R.
G.
Masand,
VIIT,
Pune
58. DEFINING A FUNCTION
return_type function_name( parameter list )
{
body of the function
}
• Return Type
• Function Name
• Parameters
• Function Body 58
Pro.
R.
G.
Masand,
VIIT,
Pune
59. FUNCTION DECLARATIONS
• A function declaration tells the compiler about a
function name and how to call the function. The
actual body of the function can be defined
separately.
• A function declaration has the following parts:
return_type function_name( parameter list );
int max(int num1, int num2);
• Function declaration is required when you define a
function in one source file and you call that
function in another file
• should declare the function at the top of the file
calling the function.
59
Pro.
R.
G.
Masand,
VIIT,
Pune
60. FUNCTION CALLING
• While creating a C++ function, we give a definition
of what the function has to do.
• To use a function, we will have to call or invoke
that function.
• When a program calls a function, program control
is transferred to the called function
• A called function performs defined task and when
its return statement is executed or when its
function-ending closing brace is reached, it returns
program control back to the main program
• Actual arguments and formal arguments
60
Pro.
R.
G.
Masand,
VIIT,
Pune
61. FUNCTION CALLING
Call Type Description
Call by value
This method copies the actual value of
an argument into the formal parameter
of the function. In this case, changes
made to the parameter inside the
function have no effect on the
argument.
Call by pointer
This method copies the address of an
argument into the formal parameter.
Inside the function, the address is used
to access the actual argument used in
the call. This means that changes made
to the parameter affect the argument.
Call by reference
This method copies the reference of an
argument into the formal parameter.
Inside the function, the reference is
used to access the actual argument used
in the call. This means that changes
made to the parameter affect the
argument.
61
Pro.
R.
G.
Masand,
VIIT,
Pune
62. POINTER
• A pointer is a variable whose value is the address of
another variable
type *var-name;
type is the pointer's base type
• it must be a valid C++ type and var-name is the
name of the pointer variable. The asterisk we used
to declare a pointer is the same asterisk that you
use for multiplication
int *ip; // pointer to an integer
double *dp; // pointer to a double
float *fp; // pointer to a float
char *ch; // pointer to character 62
Pro.
R.
G.
Masand,
VIIT,
Pune
63. USING POINTERS IN C++
#include <iostream>
using namespace std;
int main ()
{
int var = 20; // actual variable declaration.
int *ip; // pointer variable
ip = &var; // store address of var in pointer variable
cout << "Value of var variable: ";
cout << var << endl;
// print the address stored in ip pointer variable
cout << "Address stored in ip variable: ";
cout << ip << endl;
// access the value at the address available in pointer
cout << "Value of *ip variable: ";
cout << *ip << endl;
return 0;
} 63
Pro.
R.
G.
Masand,
VIIT,
Pune
64. OUTPUT
• Value of var variable: 20
• Address stored in ip variable: 0xbfc601ac
• Value of *ip variable: 20
64
Pro.
R.
G.
Masand,
VIIT,
Pune
65. C++ REFERENCES
• Think of a variable name as a label attached to the
variable's location in memory
• then think of a reference as a second label attached
to that memory location
int i = 17;
int& r = i;
Read the & in these declarations as reference
65
Pro.
R.
G.
Masand,
VIIT,
Pune
66. PROGRAM
#include <iostream>
using namespace std;
int main ()
{
// declare simple variables
int i;
double d;
// declare reference variables
int &r = i;
double & s = d;
i = 5;
cout << "Value of i : " << i << endl;
cout << "Value of i reference : " << r << endl;
d = 11.7;
cout << "Value of d : " << d << endl;
cout << "Value of d reference : " << s << endl;
return 0;
}
66
Pro.
R.
G.
Masand,
VIIT,
Pune
67. OUTPUT
Value of i : 5
Value of i reference : 5
Value of d : 11.7
Value of d reference : 11.7
67
Pro.
R.
G.
Masand,
VIIT,
Pune
68. C++ REFERENCES V/S POINTERS
• References are often confused with pointers but
three major differences between references and
pointers are:
● We cannot have NULL references. We must always be
able to assume that a reference is connected to a
legitimate piece of storage.
● Once a reference is initialized to an object, it cannot be
changed to refer to another object. Pointers can be
pointed to another object at any time.
● A reference must be initialized when it is created.
Pointers can be initialized at any time.
68
Pro.
R.
G.
Masand,
VIIT,
Pune
69. THE STANDARD INPUT STREAM (CIN)
• The predefined object cin is an instance of istream
class
• The cin object is said to be attached to the standard
input device, which usually is the keyboard.
• The cin is used in conjunction with the stream
extraction operator, which is written as >> which are
two greater than signs
int main( )
{
char name[50];
cout << "Please enter your name: ";
cin >> name;
cout << "Your name is: " << name << endl;
}
69
Pro.
R.
G.
Masand,
VIIT,
Pune
70. THE STANDARD INPUT STREAM
(CIN)(CNTD….)
• The stream extraction operator >> may be used
more than once in a single statement. To request
more than one datum you can use the following:
cin >> name >> age;
• This will be equivalent to the following two
statements:
cin >> name;
cin >> age;
70
Pro.
R.
G.
Masand,
VIIT,
Pune
71. THE STANDARD OUTPUT STREAM (COUT)
• The predefined object cout is an instance of ostream
class
• The cout object is said to be "connected to" the
standard output device, which usually is the display
screen
• The cout is used in conjunction with the stream
insertion operator, which is written as << which are
two less than signs
#include <iostream>
using namespace std;
int main( )
{
char str[] = "Hello C++";
cout << "Value of str is : " << str << endl;
71
Pro.
R.
G.
Masand,
VIIT,
Pune
72. THE CLASS 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 and it does not have any return type at all, not
even void. Constructors can be very useful for
setting initial values for certain member variables.
• 0-argument constructor
• Parameterized constructor
72
Pro.
R.
G.
Masand,
VIIT,
Pune
73. • E.g.
Class test_ctor{
private :
int x,y;
public :
test_ctor(int x=0, int y=0){
this→x = x;
this→ y=y;
}
tets_cot(){
//some code here….
}
void display(){
// some code goes here…..
}
} 73
Pro.
R.
G.
Masand,
VIIT,
Pune
75. THE CLASS DESTRUCTOR
• A destructor is a special member function of a
class that is executed whenever an object of it's
class goes out of scope or whenever the delete
expression is applied to a pointer to the object of
that class.
• A destructor will have exact same name as the class
prefixed with a tilde (~) and it can neither return a
value nor can it take any parameters. Destructor
can be very useful for releasing resources before
coming out of the program like closing files,
releasing memories etc.
75
Pro.
R.
G.
Masand,
VIIT,
Pune
77. INLINE FUNCTION
• C++ inline function is powerful concept that is
commonly used with classes
• If a function is inline, the compiler places a copy of
the code of that function at each point where the
function is called at compile time.
• Any change to an inline function could require all
clients of the function to be recompiled because
compiler would need to replace all the code once
again otherwise it will continue with old
functionality.
• To inline a function, place the keyword inline
before the function name and define the function
before any calls are made to the function
• The compiler can ignore the inline qualifier in case
defined function is more than a line.
77
Pro.
R.
G.
Masand,
VIIT,
Pune
78. INLINE (CNTD…)
• A function definition in a class definition is an inline
function definition, even without the use of the inline
specifier
#include <iostream>
using namespace std;
inline int Max(int x, int y)
{
return (x > y)? x : y;
}
// Main function for the programint
main( )
{
cout << "Max (20,10): " << Max(20,10) << endl;
cout << "Max (0,200): " << Max(0,200) << endl;
cout << "Max (100,1010): " << Max(100,1010) << endl;
return 0;
}
78
Pro.
R.
G.
Masand,
VIIT,
Pune
80. STATIC KEYWORD
• We can define class members static using static
keyword
• When we declare a member of a class as static it
means no matter how many objects of the class
are created, there is only one copy of the static
member.
• A static member is shared by all objects of the
class
• All static data is initialized to zero when the first
object is created, if no other initialization is
present
80
Pro.
R.
G.
Masand,
VIIT,
Pune
81. #include <iostream>
using namespace std;
class Box{
public:
static int objectCount;
// Constructor definition
Box(double l=2.0, double b=2.0, double h=2.0)
{
cout <<"Constructor called." << endl;
length = l;
breadth = b;
height = h;
// Increase every time object is created
objectCount++;
}
double Volume()
{
return length * breadth * height;
}
private:
double length; // Length of a box
double breadth; // Breadth of a box
double height; // Height of a box
};
// Initialize static member of class Box
int Box::objectCount = 0;
int main(void){
Box Box1(3.3, 1.2, 1.5); // Declare box1
Box Box2(8.5, 6.0, 2.0); // Declare box2
// Print total number of objects.
cout << "Total objects: " << Box::objectCount << endl;
return 0;
}
81
Pro.
R.
G.
Masand,
VIIT,
Pune
83. STATIC FUNCTION MEMBERS
• By declaring a function member as static, we make
it independent of any particular object of the class
• A static member function can be called even if no
objects of the class exist and the static functions
are accessed using only the class name and the
scope resolution operator ::
• A static member function can only access static
data member, other static member functions and
any other functions from outside the class.
Program during labs.
83
Pro.
R.
G.
Masand,
VIIT,
Pune
84. DYNAMIC MEMORY ALLOCATION AND DE-
ALLOCATION
• Memory in your C++ program is divided into two
parts
● The stack: All variables declared inside the function will
take up memory from the stack → Static memory
allocation
● The heap: This is unused memory of the program and
can be used to allocate the memory dynamically when
program runs.
→ Dynamic memory allocation
• Many times, we are not aware in advance how
much memory we will need to store particular
information in a defined variable and the size of
required memory can be determined at run time
84
Pro.
R.
G.
Masand,
VIIT,
Pune
85. DYNAMIC MEMORY ALLOCATION AND DE-
ALLOCATION(CNTD….)
• In static memory allocation, decision of
memory allocation is done at compile time
e.g. int a;
● During run time variables are created
• In dynamic allocation both decision &
allocation of memory is done during
execution time.
85
Pro.
R.
G.
Masand,
VIIT,
Pune
86. NEW AND DELETE OPERATOR
• We can allocate memory at run time within the
heap for the variable of a given type using a special
operator in C++ which returns the address of the
space allocated. This operator is called new
operator.
• Use delete operator, which de-allocates memory
previously allocated by new operator.
• Syntax :
new data-type;
data-type could be any built-in data type
86
Pro.
R.
G.
Masand,
VIIT,
Pune
87. • E.g.
#include<iostream>
using namespace std;
int main()
{
int n, *pointer,c;
cout<<“enter an integern”;
cin>>n;
pointer = new int[n];
cout<<“enter”<<n<<“ integersn”;
for(c=0;c<n;c++)
cin>>pointer[c];
cout<<“elements entered by you aren”;
for(c=0;c<n;c++)
cout<<poineter[c]<<endl;
delete[] pointer;
return 0;
}
87
Pro.
R.
G.
Masand,
VIIT,
Pune
88. NEW OPERATOR
void main(){
int x, float y, int *p;
p = new int;
}
➢ Now compiler makes an entry in symbol table
➢ new allocates memory, calls constructor
➢ New creates nameless objects.
➢ what is allocated must be de-allocated so use
delete operator which calls destructor, de-allocates
memory.
88
Pro.
R.
G.
Masand,
VIIT,
Pune
89. NAMED & NAMELESS OBJECTS....!!!
class shape{
private :
int a,b;
};
shape p; → name object created (p)
Shape *q;
q = new shape; → name less object created.
89
Pro.
R.
G.
Masand,
VIIT,
Pune
90. • E.g. New and delete
operator
Class example {
private :
int i, float a;
public :
example(){
i=0;
a=0.0;
}
Example(int ii, float aa){
i = ii;
a= aa;
}
};
void main(){
example *p1,*p2;
p1 = new example;
p2 = new
example(15,30.5);
delete p1;
delete p2;
}
90
Pro.
R.
G.
Masand,
VIIT,
Pune
91. THIS POINTER
• Also called as constant pointer
• “this” keyword is used to identify between local
and instance variables
91
Pro.
R.
G.
Masand,
VIIT,
Pune
92. • Class this_test{
private :
int i, float a;
public :
void setdata(int i, float a){
this→i = i;
this→ a= a;
}
};
void main(){
this_test t1,t2;
t1.setdata(10,20.5);
}
92
Pro.
R.
G.
Masand,
VIIT,
Pune
93. FORMATTING FLAGS AND MANIPULATORS
• The following output manipulators control the
format of the output stream
• Include <iomanip>
• The Range column tells how long the manipulator
will take effect: now inserts something at that point,
next affects only the next data element, and all
affects all subsequent data elements for the output
stream.
93
Pro.
R.
G.
Masand,
VIIT,
Pune
94. REFERENCES
• Let us c++ by yashwant kaetkar
• Object oriented programming with c++ by
balagurusamy
• http://www.uow.edu.au/~lukes/TEXTBOOK/notes-
cpp/index.html
• http://www.cplusplus.com/reference/library/manipula
tors/
• http://www.cplusplus.com/doc/tutorial/
94
Pro.
R.
G.
Masand,
VIIT,
Pune