Object Oriented Concepts
Class & Objects in C++
Constructor & Destructors in C++
Operator Overloading in C++
Friend function in C++
Data Conversion in C++
This pointer in C++
Friend class in C++
Nested Class in C++
This document provides an introduction to object-oriented programming (OOP) concepts. It defines OOP as a design philosophy that groups everything as self-sustainable objects. The key OOP concepts discussed are objects, classes, encapsulation, abstraction, inheritance, polymorphism, method overloading, method overriding, and access modifiers. Objects are instances of classes that can perform related activities, while classes are blueprints that describe objects. Encapsulation hides implementation details within classes, and abstraction focuses on what objects are rather than how they are implemented.
C++ [ principles of object oriented programming ]Rome468
C++ is an enhanced version of C that adds support for object-oriented programming. It includes everything in C and allows for defining classes and objects. Classes allow grouping of related data and functions, and objects are instances of classes. Key concepts of OOP supported in C++ include encapsulation, inheritance, and polymorphism. Encapsulation binds data and functions together in a class and allows hiding implementation details. Inheritance allows defining new classes based on existing classes to reuse their functionality. Polymorphism enables different classes to have similarly named functions that demonstrate different behavior.
This document discusses object-oriented design principles including encapsulation, abstraction, inheritance, polymorphism, and decoupling. It then introduces the SOLID principles of object-oriented design: single responsibility principle, open/closed principle, Liskov substitution principle, interface segregation principle, and dependency inversion principle. Code examples are provided to demonstrate how to apply these principles and improve code maintainability, reusability, and testability.
This document outlines the course description, textbook references, and lecture topics for an Object Oriented Programming course (OOP CCS-203) offered in the spring 2014 semester by the Department of Computer Science at COMSATS Institute of Information Technology. The course covers fundamental concepts of object oriented programming including encapsulation, inheritance, polymorphism, abstract classes, interfaces, exception handling, and event-driven programming using Java. Students are expected to complete 4 quizzes and assignments throughout the semester. The 30 lectures will cover topics ranging from basic Java syntax to advanced concepts like generics, collections, and multithreading.
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.
The document discusses the history and key concepts of C++, including its creation by Bjarne Stroustrup, the influences on its development, and its combination of efficiency from C with ease of use from object-oriented programming. It explains the three main traits of object-oriented programming - encapsulation, polymorphism, and inheritance - and provides examples of each concept. The document also provides guidance for new C++ programmers on using header files, the main function, and input/output statements in their first C++ program.
This document provides an overview of object-oriented programming (OOP) including:
- The history and key concepts of OOP like classes, objects, inheritance, polymorphism, and encapsulation.
- Popular OOP languages like C++, Java, and Python.
- Differences between procedural and OOP like top-down design and modularity.
This document discusses advance object-oriented programming concepts. It covers procedural programming vs object-oriented programming, features of OOP like classes, objects, inheritance and polymorphism. It also discusses OOP design principles like single responsibility, open-closed, Liskov substitution, dependency inversion and interface segregation principles. Examples are provided to explain concepts like inheritance, polymorphism, abstraction and interfaces. The document provides a comprehensive overview of key OOP concepts and design principles.
Std 12 computer chapter 6 object oriented concepts (part 1) by Nuzhat Memon
Introduction to class and object
Procedural (Structural) programming language
Object Oriented programming language
Two ways of programming language (POP and OOP)
four specific object properties
4 pillars of OOPs
Encapsulation in Java
Abstraction in Java
Messaging in Java
Polymorphism in Java
The document discusses object-oriented programming concepts including classes, objects, encapsulation, inheritance, polymorphism, and design patterns. It defines each concept and provides examples to illustrate how they are used in object-oriented programming and modeling. Object-oriented programming is based on representing real-world entities like cars and people as objects that have states, behaviors, and can communicate with each other through messages.
C++ was created by Bjarne Stroustrup and combines elements of C and Simula67. It supports both low-level efficiency and high-level coding through object-oriented programming principles like encapsulation, polymorphism, and inheritance. C++ programs organize code around data and define types that specify which operations can be performed on that type of data.
FellowBuddy.com is an innovative platform that brings students together to share notes, exam papers, study guides, project reports and presentation for upcoming exams.
We connect Students who have an understanding of course material with Students who need help.
Benefits:-
# Students can catch up on notes they missed because of an absence.
# Underachievers can find peer developed notes that break down lecture and study material in a way that they can understand
# Students can earn better grades, save time and study effectively
Our Vision & Mission – Simplifying Students Life
Our Belief – “The great breakthrough in your life comes when you realize it, that you can learn anything you need to learn; to accomplish any goal that you have set for yourself. This means there are no limits on what you can be, have or do.”
Like Us - https://www.facebook.com/FellowBuddycom
The document discusses key concepts in object-oriented programming (OOP) including objects, classes, encapsulation, inheritance, polymorphism, and message passing. It provides examples of a simple class named "item" that includes variables and methods. It also discusses how objects are composed of data and functions, and how classes are used to organize data and functions through principles like private/public access and data abstraction.
Defining class
Defining member functions
Static data members
Static member functions
Private data members
Public member functions
Arrays of objects
Objects as a function arguments
Constructors and destructors
Types of constructors
Handling of multiple constructors, destructors.
This document provides an overview of object-oriented programming (OOP) concepts including classes, objects, encapsulation, inheritance, polymorphism, and relationships between objects. It compares OOP to structured programming and outlines the benefits of OOP such as reusability, extensibility, and maintainability. Key OOP features like encapsulation, inheritance, polymorphism, and relationships are explained in detail. The document also introduces the Unified Modeling Language (UML) as a standard language for visualizing and modeling software systems using OOP concepts.
The document discusses object-oriented programming (OOP). It defines some key concepts in OOP including objects, classes, abstraction/encapsulation, inheritance, and polymorphism. Objects have identity, state, and behavior. Classes group similar objects and define their attributes and methods. Abstraction hides unnecessary details, while encapsulation bundles related data and functions into a class. Inheritance allows classes to inherit characteristics from other classes. Polymorphism means an object can take on multiple forms. Benefits of OOP include reusability, extensibility, understandability, and protection.
An overview of object oriented programming including the differences between OOP and the traditional structural approach, definitions of class and objects, and an easy coding example in C++. This presentation includes visual aids to make the concepts easier to understand.
This is a presentation I did for the Cedar Rapids .NET User Group (CRineta.org). It was intended to present object oriented concepts and their application in .NET and C#.
This document provides an introduction to object-oriented concepts, modeling, and system development. It discusses key topics such as:
- The benefits of object-oriented programming like modularity, information hiding, and code reuse.
- Basic concepts in OOP like objects, classes, encapsulation, inheritance, and polymorphism.
- The role of modeling in engineering by providing information about systems before they are built through mapping, reducing complexity, and being pragmatic.
- Object-oriented analysis focuses on understanding a system's functional requirements, unlike traditional function/data analysis which considers behavior and data separately.
Yevhen Kalinichenko, Senior JavaScript Developer
“Object oriented concepts in real projects”
- Abstraction. What is it and what abstraction gives us
- Inheritance. Why do we need inheritance? Composition
over inheritance.
- Encapsulation. Why it’s so important to hide
implementation. Breaking of encapsulation leads us to
maintenance hell
- Polymorphism. Working with interface but not with
concrete implementation
- Single responsibility. Why “classes” must adhere single
responsibility
- Open/Closed principle
- Related topics – cohesion, coupling, interfaces,
separation of responsibilities for each team member.
A class is the blueprint from which individual objects are created. In the real world, you'll often find many individual objects all of the same kind. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles.
The document provides an introduction to object-oriented programming concepts and Java. It discusses key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also explains the basics of Java, including its history, features like being platform independent and secure, and the structure of a Java program with main components like packages, import statements, and class definitions.
Ever heard of the Law of Demeter? How about the Liskov Substitution Principle? This talk introduces key object-oriented laws and principles currently used in our field and provides guidance for their use when building applications on the .NET platform.
the Concept of Object-Oriented ProgrammingAida Ramlan II
This document provides an introduction to object-oriented programming (OOP). It discusses key OOP concepts like enabling code reuse through inheritance and modifying existing code more easily. While OOP became popular in the 1980s, its origins date back to the Simula programming languages from the 1960s. OOP provides clear modular structures, makes code maintenance and modification easier, and offers a framework for code libraries. The document also defines important OOP terminology like classes, objects, encapsulation, abstraction, inheritance, polymorphism and distinguishes between abstraction and encapsulation.
This document discusses object-oriented programming (OOP) and its advantages over other programming paradigms. It begins with an introduction to programming paradigms including procedural, object-based, and object-oriented. The key concepts of OOP are then defined, including abstraction, encapsulation, modularity, inheritance, and polymorphism. Advantages of OOP include code reusability, ease of understanding and maintenance. Disadvantages include potential overgeneralization of classes and difficulty of proper planning and design.
This document provides an overview of object-oriented programming concepts including classes, objects, inheritance, abstraction, encapsulation, and polymorphism. It defines OOP as an engineering approach for building software systems based on modeling real-world entities as classes and objects that exchange messages. Key concepts are explained such as classes defining attributes and behaviors of objects, objects being instances of classes, and communication between objects occurring through messages. The four main principles of OOP - inheritance, abstraction, encapsulation, and polymorphism - are also summarized.
Program versus Software, Software Characteristics, S/W Failure rate, Evolution Pattern, Types of Software, Stakeholders in Software Engineering, Software Quality, Software Crisis, Software Engineering: A Layered Technology, Evolution of Design Techniques, Exploratory style of S/W Development
This document provides an introduction to the scripting languages AWK and GNUPlot. It discusses basics of AWK including its structure and examples of using AWK to parse text files and extract fields. It also covers basics of GNUPlot including how to generate different plot types from data files and customize plots. Finally, it provides examples of using AWK to analyze network simulation trace files generated by NS-2 to calculate packet statistics and average delay.
Std 12 computer chapter 6 object oriented concepts (part 1) by Nuzhat Memon
Introduction to class and object
Procedural (Structural) programming language
Object Oriented programming language
Two ways of programming language (POP and OOP)
four specific object properties
4 pillars of OOPs
Encapsulation in Java
Abstraction in Java
Messaging in Java
Polymorphism in Java
The document discusses object-oriented programming concepts including classes, objects, encapsulation, inheritance, polymorphism, and design patterns. It defines each concept and provides examples to illustrate how they are used in object-oriented programming and modeling. Object-oriented programming is based on representing real-world entities like cars and people as objects that have states, behaviors, and can communicate with each other through messages.
C++ was created by Bjarne Stroustrup and combines elements of C and Simula67. It supports both low-level efficiency and high-level coding through object-oriented programming principles like encapsulation, polymorphism, and inheritance. C++ programs organize code around data and define types that specify which operations can be performed on that type of data.
FellowBuddy.com is an innovative platform that brings students together to share notes, exam papers, study guides, project reports and presentation for upcoming exams.
We connect Students who have an understanding of course material with Students who need help.
Benefits:-
# Students can catch up on notes they missed because of an absence.
# Underachievers can find peer developed notes that break down lecture and study material in a way that they can understand
# Students can earn better grades, save time and study effectively
Our Vision & Mission – Simplifying Students Life
Our Belief – “The great breakthrough in your life comes when you realize it, that you can learn anything you need to learn; to accomplish any goal that you have set for yourself. This means there are no limits on what you can be, have or do.”
Like Us - https://www.facebook.com/FellowBuddycom
The document discusses key concepts in object-oriented programming (OOP) including objects, classes, encapsulation, inheritance, polymorphism, and message passing. It provides examples of a simple class named "item" that includes variables and methods. It also discusses how objects are composed of data and functions, and how classes are used to organize data and functions through principles like private/public access and data abstraction.
Defining class
Defining member functions
Static data members
Static member functions
Private data members
Public member functions
Arrays of objects
Objects as a function arguments
Constructors and destructors
Types of constructors
Handling of multiple constructors, destructors.
This document provides an overview of object-oriented programming (OOP) concepts including classes, objects, encapsulation, inheritance, polymorphism, and relationships between objects. It compares OOP to structured programming and outlines the benefits of OOP such as reusability, extensibility, and maintainability. Key OOP features like encapsulation, inheritance, polymorphism, and relationships are explained in detail. The document also introduces the Unified Modeling Language (UML) as a standard language for visualizing and modeling software systems using OOP concepts.
The document discusses object-oriented programming (OOP). It defines some key concepts in OOP including objects, classes, abstraction/encapsulation, inheritance, and polymorphism. Objects have identity, state, and behavior. Classes group similar objects and define their attributes and methods. Abstraction hides unnecessary details, while encapsulation bundles related data and functions into a class. Inheritance allows classes to inherit characteristics from other classes. Polymorphism means an object can take on multiple forms. Benefits of OOP include reusability, extensibility, understandability, and protection.
An overview of object oriented programming including the differences between OOP and the traditional structural approach, definitions of class and objects, and an easy coding example in C++. This presentation includes visual aids to make the concepts easier to understand.
This is a presentation I did for the Cedar Rapids .NET User Group (CRineta.org). It was intended to present object oriented concepts and their application in .NET and C#.
This document provides an introduction to object-oriented concepts, modeling, and system development. It discusses key topics such as:
- The benefits of object-oriented programming like modularity, information hiding, and code reuse.
- Basic concepts in OOP like objects, classes, encapsulation, inheritance, and polymorphism.
- The role of modeling in engineering by providing information about systems before they are built through mapping, reducing complexity, and being pragmatic.
- Object-oriented analysis focuses on understanding a system's functional requirements, unlike traditional function/data analysis which considers behavior and data separately.
Yevhen Kalinichenko, Senior JavaScript Developer
“Object oriented concepts in real projects”
- Abstraction. What is it and what abstraction gives us
- Inheritance. Why do we need inheritance? Composition
over inheritance.
- Encapsulation. Why it’s so important to hide
implementation. Breaking of encapsulation leads us to
maintenance hell
- Polymorphism. Working with interface but not with
concrete implementation
- Single responsibility. Why “classes” must adhere single
responsibility
- Open/Closed principle
- Related topics – cohesion, coupling, interfaces,
separation of responsibilities for each team member.
A class is the blueprint from which individual objects are created. In the real world, you'll often find many individual objects all of the same kind. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles.
The document provides an introduction to object-oriented programming concepts and Java. It discusses key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also explains the basics of Java, including its history, features like being platform independent and secure, and the structure of a Java program with main components like packages, import statements, and class definitions.
Ever heard of the Law of Demeter? How about the Liskov Substitution Principle? This talk introduces key object-oriented laws and principles currently used in our field and provides guidance for their use when building applications on the .NET platform.
the Concept of Object-Oriented ProgrammingAida Ramlan II
This document provides an introduction to object-oriented programming (OOP). It discusses key OOP concepts like enabling code reuse through inheritance and modifying existing code more easily. While OOP became popular in the 1980s, its origins date back to the Simula programming languages from the 1960s. OOP provides clear modular structures, makes code maintenance and modification easier, and offers a framework for code libraries. The document also defines important OOP terminology like classes, objects, encapsulation, abstraction, inheritance, polymorphism and distinguishes between abstraction and encapsulation.
This document discusses object-oriented programming (OOP) and its advantages over other programming paradigms. It begins with an introduction to programming paradigms including procedural, object-based, and object-oriented. The key concepts of OOP are then defined, including abstraction, encapsulation, modularity, inheritance, and polymorphism. Advantages of OOP include code reusability, ease of understanding and maintenance. Disadvantages include potential overgeneralization of classes and difficulty of proper planning and design.
This document provides an overview of object-oriented programming concepts including classes, objects, inheritance, abstraction, encapsulation, and polymorphism. It defines OOP as an engineering approach for building software systems based on modeling real-world entities as classes and objects that exchange messages. Key concepts are explained such as classes defining attributes and behaviors of objects, objects being instances of classes, and communication between objects occurring through messages. The four main principles of OOP - inheritance, abstraction, encapsulation, and polymorphism - are also summarized.
Program versus Software, Software Characteristics, S/W Failure rate, Evolution Pattern, Types of Software, Stakeholders in Software Engineering, Software Quality, Software Crisis, Software Engineering: A Layered Technology, Evolution of Design Techniques, Exploratory style of S/W Development
This document provides an introduction to the scripting languages AWK and GNUPlot. It discusses basics of AWK including its structure and examples of using AWK to parse text files and extract fields. It also covers basics of GNUPlot including how to generate different plot types from data files and customize plots. Finally, it provides examples of using AWK to analyze network simulation trace files generated by NS-2 to calculate packet statistics and average delay.
Is your company fully engaged towards innovation?Sebastien Juras
Innovation is a popular word for management. And they are right : today in the age of information, it is mandatory for all companies to bet on innovation if they want to survive. But in order to manage a so big change, it is vital to be fully engaged to this transformation.
This document provides an overview of dependency relationships, interfaces, and basic behavior modeling in UML. It defines dependencies as relationships between model elements where one element requires the other. Dependency relationships can be further specified using keywords or stereotypes. Interfaces specify a subset of operations and attributes for classifiers to implement. Basic behavior in UML includes state machines, activities, interactions, and use cases, and behavior is always associated with an owning classifier or operation.
Introduction to database-Formal Query language and Relational calculusAjit Nayak
The document provides an introduction to relational databases and formal relational query languages. It discusses relational algebra and relational calculus as the two formal query languages that form the mathematical foundation for commercial relational query languages. Relational algebra is a procedural query language that supports operations like select, project, union, set difference, cartesian product and rename. Example queries are provided for each operation to demonstrate their usage. Relational calculus is described as a non-procedural query language with examples of queries written using its syntax.
Psychology explains the power of StorytellingSebastien Juras
Communication is a fundamental skill, but a difficult art. Storytelling is a marvelous tool to help getting yout point accross to others. Psychology explains why.
A meta story.
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
Three key points about transactions from the document:
1. A transaction is a unit of program execution that accesses and possibly updates data items in a database. It must have ACID properties - Atomicity, Consistency, Isolation, and Durability - to preserve data integrity.
2. Concurrency control schemes allow multiple transactions to run concurrently for better performance, but they must enforce transaction isolation to prevent inconsistent outcomes.
3. A concurrent schedule is considered serializable, and thus preserves isolation, if it is equivalent to some serial schedule where transactions execute one after another. This can be determined using precedence graphs.
El documento proporciona una introducción a Extreme Programming (XP), uno de los métodos ágiles más conocidos. Describe brevemente los valores fundamentales de XP, sus principales prácticas como programación en parejas y pruebas unitarias, y su énfasis en la comunicación, simplicidad y retroalimentación continua a través de iteraciones cortas. También resume el ciclo de vida típico de XP, incluidas las actividades de planeación, desarrollo e integración iterativa.
Software Engineering :UML class diagramsAjit Nayak
The document discusses UML class diagrams and their components. It defines a class diagram as representing entities with common features as rectangles divided into compartments for the class name, attributes, and operations. It provides examples of how different relationships like association, aggregation, and generalization are depicted. Key points include that association represents a "has-a" relationship, aggregation a whole-part relationship where parts can exist independently, and generalization an "is-a" relationship of inheritance.
El documento describe los conceptos clave detrás del diseño orientado a objetos, incluyendo la metáfora de la célula, objetos, roles, responsabilidades y colaboraciones. Explica que los objetos encapsulan información y servicios y colaboran entre sí para resolver problemas mayores.
UML (Unified Modeling Language) was created in the 1990s as a general-purpose modeling language for software engineering. It was developed by Grady Booch, James Rumbaugh, and Ivar Jacobson, known as "the three amigos". UML was later standardized by the Object Management Group and now includes diagrams for modeling software structure, behavior, and architecture. The OMG also established a certification program with three levels to ensure consistent understanding and proficiency with UML.
This document provides an introduction to databases and SQL. It discusses the relational model and how data is stored in tables with rows and columns. It also describes the different languages used in SQL - DDL for data definition, DML for data manipulation, and DCL for data control. Examples are provided of creating tables, inserting data, and using select statements to query and retrieve data. Group functions like COUNT, AVG, MAX etc. are also introduced. The document emphasizes the importance of transactions and using COMMIT to save changes permanently to the database.
The document discusses various Unified Modeling Language (UML) concepts including constraints, instance specifications, classifiers, features, operations, properties, and attributes. Constraints define expressions that must always be true. Instance specifications represent concrete instances and can specify attribute values incompletely. Classifiers classify instances and can be generalized. Features describe structural and behavioral characteristics, and operations specify behaviors with parameters, preconditions, and postconditions. Properties include attributes, which are contained in every object of a class. Attributes have a defined syntax including visibility, type, multiplicity, and property strings.
Este documento describe los perfiles UML y algunos perfiles estándar. Brevemente resume los perfiles UML como una extensión de UML que permite adaptarlo a dominios específicos a través de estereotipos, valores etiquetados y restricciones. Luego, menciona algunos perfiles estándar como SPEM para modelado de procesos de software, IFML para interfaces de usuario, UTP para pruebas y BPMN para procesos de negocio.
The document discusses parallel programming using MPI (Message Passing Interface). It introduces MPI as a standard for message passing between processes. It describes how to set up a basic parallel computing environment using a cluster of networked computers. It provides examples of using MPI functions to implement parallel algorithms, including point-to-point and collective communication like broadcast, gather, and scatter.
How the history of the humanity explains the difficulties of old companies are facing today. This story is the first part of the tribute to innovation trilogy.
Six things to know about your brain to become an expertSebastien Juras
Anyone can be an expert at anything. Our brain has properties to make this happen.
This story outline these properties and show you the way to follow.
It is up to you to decide which topic you want to be an expert and be fully engaged to it.
Innovation is almost impossible for older companiesSebastien Juras
The document discusses the obstacles that older companies face in innovating. It argues that innovation is essential for survival, but internal factors make it almost impossible for most companies. The main obstacles are: 1) People's skills and habits resist change. 2) Managers' interests are threatened by changes that could jeopardize their positions and privileges. 3) Shareholders demand predictable plans, but innovation requires uncertainty. 4) Financial pressures lead companies to prioritize short-term fixes over long-term innovation investments. Due to these obstacles, the document concludes that the path to innovation is impossible for most companies.
Este documento describe los principios y prácticas de administración de requisitos, incluyendo el control de cambios de requisitos, la trazabilidad de requisitos y el proceso de control de cambios. Explica que una vez aprobados, los requisitos constituyen la línea base del proyecto y deben mantenerse actualizados a medida que el proyecto avanza. También describe cómo monitorear el estado de los requisitos, gestionar cambios propuestos y realizar un análisis de impacto para comprender las implicaciones de los cambios
This document summarizes key concepts from a lecture on object-oriented programming and design using Java. It defines classes and objects, and core OO principles like abstraction, encapsulation, inheritance and polymorphism. It provides examples of classes like Student and how they define state as variables and behavior as methods. Inheritance, association, aggregation and composition relationships between classes are also explained. The lecture introduces Unified Modeling Language (UML) diagrams for modeling object-oriented systems and Java concepts.
Object oriented programming concepts such as abstraction, encapsulation, inheritance and polymorphism are supported in .NET languages like C# and Visual Basic. Encapsulation groups related properties and methods into a single object. Inheritance allows new classes to be created from an existing class. Polymorphism allows multiple classes to be used interchangeably even if they implement properties or methods differently.
Object oriented programming views a system as a collection of objects that contain both data (state) and behaviors (operations). An object has an identity, state, and behavior. Classes are sets of similar objects that share common attributes and behaviors. The key characteristics of object oriented programming are abstraction, encapsulation, inheritance, and polymorphism. Abstraction involves hiding non-essential details and focusing on essential characteristics. Encapsulation implements abstraction by hiding implementation details within an object. Inheritance allows new classes to inherit and modify attributes and behaviors from existing classes. Polymorphism means an object can behave differently under different circumstances.
The document discusses object-oriented programming and the Java programming language. It begins by describing the different types of computer languages, including machine languages, assembly languages, and high-level languages. It then provides an overview of the Java programming language, noting that it is a high-level, compiled and interpreted language. The document also discusses key concepts of object-oriented programming like objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It provides examples of objects, classes, and how to initialize objects in Java.
This document covers the key concepts of object-oriented programming including classes, objects, properties, methods, abstraction, encapsulation, inheritance, and polymorphism. It discusses the advantages of OOP over structured programming and provides examples. The objectives of the session are to explain structured programming and its drawbacks, discuss OOP and its advantages, and define and describe the basic concepts of OOP.
This document provides a syllabus for a Java programming course including:
- 7 topics that will be covered ranging from Java fundamentals to database connectivity.
- A practical exam worth 50 marks involving 10 programming assignments.
- 12 programming assignments that will be completed as part of the term work.
- 4 references books that will be used for the course.
+work()
Worker
+work()
SuperWorker
+work()
+superWork()
Manager
+setAssistant(Assistant)
Worker
+work()
SuperWorker
+work()
+superWork()
- Manager depends on concrete classes
- Worker/SuperWorker depend on Manager
- Manager depends on abstraction (Assistant)
- Concrete classes depend on abstraction
- Inversion of Control
Page 33
Interface Segregation Principle(ISP)
“Clients should not be forced to depend on interfaces that they do not
use.”
Large interfaces are bad because:
- Clients are forced to
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the internal representation of an object within its public interface. A class combines both abstraction and encapsulation, defining the data and operations of an object. Objects are instantiations of classes that are initialized via constructors and cleaned up via destructors.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object's methods and data within its class. A class defines both the data and behaviors of an object through its public interface and private implementation. Objects are instantiations of classes that come to life through constructors and die through destructors while maintaining data integrity.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the internal representation of an object within its class. A class defines both the data and behaviors of an object through its public interface and private implementation. Objects are instantiations of classes that come to life through constructors and die through destructors while maintaining data integrity.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object within a class. A class defines both the data and operations of an object through its interface and implementation. Objects are instantiations of classes that come to life through constructors and die through destructors, ensuring proper initialization and resource cleanup.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object within a class. A class defines both the data and operations of an object through its interface and implementation. Objects are instantiations of classes that come to life through constructors and die through destructors, ensuring proper initialization and resource cleanup.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object's methods and data. A class combines abstraction and encapsulation, defining the data attributes and methods while hiding implementation details. Objects are instantiations of classes that come to life through constructors and die through destructors.
This document discusses the key concepts of object-oriented programming including abstraction, encapsulation, classes and objects. It defines abstraction as focusing on the essential characteristics of an object and hiding unnecessary details. Encapsulation hides the implementation of an object's methods and data. A class combines abstraction and encapsulation, defining the data attributes and methods while hiding implementation details. Objects are instantiations of classes that come to life through constructors and die through destructors.
This document provides an overview of object-oriented programming concepts in C++. It begins with a comparison of procedure-oriented programming and object-oriented programming. Key concepts of OOP like objects, classes, encapsulation, inheritance, and polymorphism are then explained. The basic structure of a C++ program including header files, functions, variables and data types, input/output operators, and comments is also covered at a high level.
This document provides an introduction to object-oriented programming concepts in Java. It outlines the syllabus structure and covers key OOP principles like classes, objects, abstraction, inheritance, encapsulation, and polymorphism. It also discusses Java essentials such as the Java virtual machine and language features. Programming constructs in Java like variables, data types, operators, and flow control are reviewed. The document serves as an introductory guide to learning OOP with Java.
Abstraction allows us to focus on essential details and suppress irrelevant details. It is one of the most important techniques for managing complexity in systems. There are five levels of abstraction in object-oriented programs ranging from viewing a program as interacting objects to considering individual methods in isolation. Forms of abstraction include specialization, division into parts, and multiple views. Understanding the history of abstraction mechanisms like procedures, modules, abstract data types, and objects provides context for object-oriented programming.
This document provides a syllabus for a Java Programming course. The course consists of 7 topics that will be covered through lectures and practical sessions over several weeks. Students will have one exam worth 100 marks and a practical exam worth 50 marks. They will also complete term work assignments worth 25 marks. The topics covered include Java fundamentals, classes, exception handling, IO packages, multi-threading, GUI, and database connectivity. Students will submit programming assignments related to these topics as part of their term work. References for the course are also provided.
This document provides an introduction to object-oriented programming (OOP) using Java. It defines key OOP concepts like classes, objects, encapsulation, inheritance and polymorphism. It explains the differences between procedural and object-oriented paradigms. Popular OOP languages like Java, C++, Smalltalk are listed, with examples of how classes and objects are used to represent real-world entities like vehicles. The advantages of OOP like code reusability and modular design are also summarized.
1) Software testing techniques like unit testing, white-box testing, and path testing were discussed. Unit testing involves equivalence partitioning and boundary value analysis. White-box testing requires knowledge of internal structure and aims for statement, branch, and path coverage.
2) Equivalence partitioning divides inputs into classes and one test per class is sufficient. Boundary value analysis tests boundaries of classes. Path coverage requires designing test cases to execute all linearly independent paths in a program.
3) Cyclomatic complexity provides a lower bound on number of test cases needed for path coverage. It is computed based on number of edges and nodes in a control flow graph. Automated testing tools can help with regression and UI testing.
Software Engineering :Behavioral Modelling - II State diagramAjit Nayak
This document discusses software engineering principles related to behavioral modeling using state diagrams and activity diagrams. It provides examples and explanations of key concepts in behavioral modeling including states, events, conditions, transitions, activities, actions, concurrency, and swimlanes. It also discusses implementing classes based on interaction and state diagrams and provides an example state diagram for the states of a CourseSection class.
Software Engineering :Behavioral Modelling - I Sequence diagram Ajit Nayak
This document discusses software engineering principles related to domain and behavioral modeling. It defines three types of objects in domain modeling - boundary objects, entity objects, and controller objects. It also describes how behavioral models like sequence diagrams and activity diagrams can be used to model interactions between objects to produce system behaviors specified in use cases. Examples of applying these concepts to model a tic-tac-toe game and a supermarket prize scheme system are also provided.
This document provides an overview of object-oriented software design using the Unified Modeling Language (UML). It discusses key concepts in object-oriented design like classes, methods, inheritance, and relationships. It also describes UML diagrams for modeling different aspects of a system, including use case diagrams for capturing user requirements, class diagrams for modeling the structural design, and how UML was developed through the merging of earlier object-oriented modeling notations. The document aims to introduce software engineering principles and object-oriented modeling techniques using UML.
The document discusses requirements analysis and specification in software engineering. It defines what requirements are and explains the typical activities involved - requirements gathering, analysis, and specification. The importance of documenting requirements in a Software Requirements Specification (SRS) document is explained. Key sections of an SRS like stakeholders, types of requirements (functional and non-functional), and examples are covered. Special attention is given to requirements for critical systems and importance of non-functional requirements.
This document provides an overview of various software engineering process models, including:
- Waterfall model which divides the software development life cycle into sequential phases like requirements, design, implementation, testing and maintenance.
- Iterative waterfall model which allows for feedback loops between phases to catch errors earlier.
- Prototyping model which involves building prototypes to refine requirements before development.
- Incremental/evolutionary model which develops the system in modules through successive versions.
- Spiral model which represents the software process as iterative loops to progressively develop and test the product.
- Agile models like Scrum and XP which emphasize adaptive planning, evolutionary development, team collaboration and frequent delivery of working software.
This document provides an introduction and overview of NS2, a network simulator. It discusses what network simulation is and the architecture of NS2. It also provides sample NS2 input scripts written in Tcl that define nodes, links, and events. Sample output from NS2 simulations include packet trace files and NAM trace files that can be visualized. The document describes how to learn and use Tcl to write NS2 scripts, run simulations, extract data, and plot results. It also gives examples of basic Tcl commands and programming constructs like variables, control flow, arrays, and procedures.
This document provides an introduction to the network simulator NS-2 and its scripting language OTcl. It discusses basics of OTcl like classes, objects, and methods. It provides examples of creating classes and objects in OTcl. It also explains the structure of an NS-2 simulation including creating the event scheduler, topology, sending data using UDP/TCP, and tracing outputs. Suggested readings on OTcl and NS-2 tutorials are provided at the end.
This document provides an introduction to socket programming in C on Linux. Some key points:
- Sockets allow communication between processes over a network and act as an interface between applications and the network. They are represented by file descriptors.
- There are two main types of sockets - stream sockets (TCP) which provide reliable, ordered data transmission and datagram sockets (UDP) which are unreliable but do not require a connection.
- The socket API includes functions like socket(), bind(), listen(), accept(), connect(), recv(), send(), etc. to create and manage sockets and network communication.
- Data structures like sockaddr_in are used to store socket addresses containing IP and port. Byte ordering functions like
Object Oriented Analysis Design using UMLAjit Nayak
The document discusses object-oriented analysis and design (OOAD) and the Unified Modeling Language (UML). It describes the key concepts in OOAD like analysis, design, domain modeling, use cases, interaction diagrams, and class diagrams. It then explains the basic building blocks of UML including things (classes, interfaces etc.), relationships (generalization, association etc.), and diagrams (class, sequence etc.). The rest of the document provides details on modeling classes in UML including attributes, operations, responsibilities and visibility.
Operating Systems Part III-Memory ManagementAjit Nayak
The document discusses memory management techniques in operating systems. It describes how programs must be loaded into memory to execute and memory addresses are represented at different stages. It introduces the concepts of logical and physical address spaces and how they are mapped using a memory management unit. It also summarizes common memory management techniques like paging, segmentation, and swapping that allow processes to be allocated non-contiguous regions of physical memory from a pool of memory frames and backed by disk. Paging partitions both logical and physical memory into fixed-size pages and frames, using a page table to map virtual to physical addresses.
The document provides an introduction to operating systems. It defines an operating system as a program that acts as an intermediary between the user and computer hardware. The goals of an operating system are to execute user programs, make the computer system convenient to use, and efficiently use computer hardware resources. A computer system consists of hardware, an operating system, application programs, and users. The operating system controls and coordinates the use of hardware resources among applications and users.
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockAjit Nayak
This document discusses interprocess communication and CPU scheduling in operating systems. It covers two models of interprocess communication: shared memory and message passing. It also describes different CPU scheduling algorithms like first-come first-served (FCFS), shortest job first (SJF), priority scheduling, and round-robin. The key aspects of process synchronization, producer-consumer problem, and implementation of message passing are explained.
This document provides an introduction to relational database design and normalization. The goal of normalization is to avoid data redundancy and anomalies. Examples of anomalies include insertion anomalies where new data cannot be added without existing data, and deletion anomalies where deleting data also deletes other related data. The document discusses functional dependencies and normal forms to help guide the decomposition of relations into multiple normalized relations while preserving data integrity and dependencies.
This document provides an introduction to Entity-Relationship (ER) data modeling. It describes the basic concepts of entities, attributes, relationships, and keys. It explains how ER diagrams can be used to graphically represent these concepts and the structure of a database. The document also covers entity types, relationship types, participation constraints, mapping cardinalities, weak entities, and how to represent these concepts in an ER diagram.
Error detection and correction
Data link control and protocols
Point-to-Point access (PPP)
Multiple Access
Local Area Networks: Ethernet
Wireless LANS
Virtual Circuit Switching: Frame Relay and ATM
Data Communication
Networks & Internet
Protocols & Standards
Layered Tasks
Internet Model
OSI Model
Digital Transmission
Analog Transmission
Multiplexing
Transmission Media
Circuit switching and Telephone Network
Signals
Digital Transmission
Analog Transmission
Multiplexing
Transmission Media
Object Oriented Programming using C++ Part IIIAjit Nayak
The document discusses inheritance in object-oriented programming. It defines inheritance as a technique where a new subclass inherits attributes and behaviors from an existing superclass without needing to redefine them. This allows code reuse and reduces development costs. The document provides examples of single inheritance with classes like Employee and Manager, and multi-level inheritance with Student, Test, and Result classes. It also discusses polymorphism through method overriding and different types of inheritance like public, private and protected.
Object Oriented Programming using C++ Part IAjit Nayak
This document provides an introduction to object-oriented programming using C++. It outlines the topics that will be covered in the course, including fundamentals, simple programs, operators, data types, namespaces, function prototypes, references, default arguments, function overloading, and inline functions. It discusses the motivation for learning OOP and C++. The document also contains examples of simple C++ programs and explanations of concepts like function prototypes, call by value/reference, and overloading. The goal of the course is to understand object-oriented thinking and become familiar with programming in C++.
Computer Fundamentals & Intro to C Programming module iAjit Nayak
Introduction to Computers
Evolution of Computers
Computer Generations
Basic Computer Organization
Memory Hierarchy
I/O devices
Computer Software
Planning Computer Program
Introduction to C programming
Structure of C Programming
Datatype
Constant
Variable
Expression
Conditional Expression
Precede
Analysis of reinforced concrete deep beam is based on simplified approximate method due to the complexity of the exact analysis. The complexity is due to a number of parameters affecting its response. To evaluate some of this parameters, finite element study of the structural behavior of the reinforced self-compacting concrete deep beam was carried out using Abaqus finite element modeling tool. The model was validated against experimental data from the literature. The parametric effects of varied concrete compressive strength, vertical web reinforcement ratio and horizontal web reinforcement ratio on the beam were tested on eight (8) different specimens under four points loads. The results of the validation work showed good agreement with the experimental studies. The parametric study revealed that the concrete compressive strength most significantly influenced the specimens’ response with the average of 41.1% and 49 % increment in the diagonal cracking and ultimate load respectively due to doubling of concrete compressive strength. Although the increase in horizontal web reinforcement ratio from 0.31 % to 0.63 % lead to average of 6.24 % increment on the diagonal cracking load, it does not influence the ultimate strength and the load-deflection response of the beams. Similar variation in vertical web reinforcement ratio leads to an average of 2.4 % and 15 % increment in cracking and ultimate load respectively with no appreciable effect on the load-deflection response.
Fluid mechanics is the branch of physics concerned with the mechanics of fluids (liquids, gases, and plasmas) and the forces on them. Originally applied to water (hydromechanics), it found applications in a wide range of disciplines, including mechanical, aerospace, civil, chemical, and biomedical engineering, as well as geophysics, oceanography, meteorology, astrophysics, and biology.
It can be divided into fluid statics, the study of various fluids at rest, and fluid dynamics.
Fluid statics, also known as hydrostatics, is the study of fluids at rest, specifically when there's no relative motion between fluid particles. It focuses on the conditions under which fluids are in stable equilibrium and doesn't involve fluid motion.
Fluid kinematics is the branch of fluid mechanics that focuses on describing and analyzing the motion of fluids, such as liquids and gases, without considering the forces that cause the motion. It deals with the geometrical and temporal aspects of fluid flow, including velocity and acceleration. Fluid dynamics, on the other hand, considers the forces acting on the fluid.
Fluid dynamics is the study of the effect of forces on fluid motion. It is a branch of continuum mechanics, a subject which models matter without using the information that it is made out of atoms; that is, it models matter from a macroscopic viewpoint rather than from microscopic.
Fluid mechanics, especially fluid dynamics, is an active field of research, typically mathematically complex. Many problems are partly or wholly unsolved and are best addressed by numerical methods, typically using computers. A modern discipline, called computational fluid dynamics (CFD), is devoted to this approach. Particle image velocimetry, an experimental method for visualizing and analyzing fluid flow, also takes advantage of the highly visual nature of fluid flow.
Fundamentally, every fluid mechanical system is assumed to obey the basic laws :
Conservation of mass
Conservation of energy
Conservation of momentum
The continuum assumption
For example, the assumption that mass is conserved means that for any fixed control volume (for example, a spherical volume)—enclosed by a control surface—the rate of change of the mass contained in that volume is equal to the rate at which mass is passing through the surface from outside to inside, minus the rate at which mass is passing from inside to outside. This can be expressed as an equation in integral form over the control volume.
The continuum assumption is an idealization of continuum mechanics under which fluids can be treated as continuous, even though, on a microscopic scale, they are composed of molecules. Under the continuum assumption, macroscopic (observed/measurable) properties such as density, pressure, temperature, and bulk velocity are taken to be well-defined at "infinitesimal" volume elements—small in comparison to the characteristic length scale of the system, but large in comparison to molecular length scale
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...Infopitaara
A feed water heater is a device used in power plants to preheat water before it enters the boiler. It plays a critical role in improving the overall efficiency of the power generation process, especially in thermal power plants.
🔧 Function of a Feed Water Heater:
It uses steam extracted from the turbine to preheat the feed water.
This reduces the fuel required to convert water into steam in the boiler.
It supports Regenerative Rankine Cycle, increasing plant efficiency.
🔍 Types of Feed Water Heaters:
Open Feed Water Heater (Direct Contact)
Steam and water come into direct contact.
Mixing occurs, and heat is transferred directly.
Common in low-pressure stages.
Closed Feed Water Heater (Surface Type)
Steam and water are separated by tubes.
Heat is transferred through tube walls.
Common in high-pressure systems.
⚙️ Advantages:
Improves thermal efficiency.
Reduces fuel consumption.
Lowers thermal stress on boiler components.
Minimizes corrosion by removing dissolved gases.
ELectronics Boards & Product Testing_Shiju.pdfShiju Jacob
This presentation provides a high level insight about DFT analysis and test coverage calculation, finalizing test strategy, and types of tests at different levels of the product.
Raish Khanji GTU 8th sem Internship Report.pdfRaishKhanji
This report details the practical experiences gained during an internship at Indo German Tool
Room, Ahmedabad. The internship provided hands-on training in various manufacturing technologies, encompassing both conventional and advanced techniques. Significant emphasis was placed on machining processes, including operation and fundamental
understanding of lathe and milling machines. Furthermore, the internship incorporated
modern welding technology, notably through the application of an Augmented Reality (AR)
simulator, offering a safe and effective environment for skill development. Exposure to
industrial automation was achieved through practical exercises in Programmable Logic Controllers (PLCs) using Siemens TIA software and direct operation of industrial robots
utilizing teach pendants. The principles and practical aspects of Computer Numerical Control
(CNC) technology were also explored. Complementing these manufacturing processes, the
internship included extensive application of SolidWorks software for design and modeling tasks. This comprehensive practical training has provided a foundational understanding of
key aspects of modern manufacturing and design, enhancing the technical proficiency and readiness for future engineering endeavors.
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYijscai
With the increased use of Artificial Intelligence (AI) in malware analysis there is also an increased need to
understand the decisions models make when identifying malicious artifacts. Explainable AI (XAI) becomes
the answer to interpreting the decision-making process that AI malware analysis models use to determine
malicious benign samples to gain trust that in a production environment, the system is able to catch
malware. With any cyber innovation brings a new set of challenges and literature soon came out about XAI
as a new attack vector. Adversarial XAI (AdvXAI) is a relatively new concept but with AI applications in
many sectors, it is crucial to quickly respond to the attack surface that it creates. This paper seeks to
conceptualize a theoretical framework focused on addressing AdvXAI in malware analysis in an effort to
balance explainability with security. Following this framework, designing a machine with an AI malware
detection and analysis model will ensure that it can effectively analyze malware, explain how it came to its
decision, and be built securely to avoid adversarial attacks and manipulations. The framework focuses on
choosing malware datasets to train the model, choosing the AI model, choosing an XAI technique,
implementing AdvXAI defensive measures, and continually evaluating the model. This framework will
significantly contribute to automated malware detection and XAI efforts allowing for secure systems that
are resilient to adversarial attacks.
This paper proposes a shoulder inverse kinematics (IK) technique. Shoulder complex is comprised of the sternum, clavicle, ribs, scapula, humerus, and four joints.
The role of the lexical analyzer
Specification of tokens
Finite state machines
From a regular expressions to an NFA
Convert NFA to DFA
Transforming grammars and regular expressions
Transforming automata to grammars
Language for specifying lexical analyzers
2. OOP/AKN/Part_II/2
Contents
Object Oriented Concepts
Class & Objects
Constructor & Destrctors
Operator Overloading
Friend function
Data Conversion
This pointer
Friend class
Nested Class
3. OOP/AKN/Part_II/3
How to Solve a Complex System?
The Technique of mastering complexity has
been known since ancient times “Divide and
Rule” …Dijkstra
i.e Decomposition of the Problem
Intelligent decomposition directly addresses
the inherent complexity of software by forcing
a division of systems state space
…Parnas
4. OOP/AKN/Part_II/4
Decomposition
Algorithmic/Functional Decomposition
1. Divide the system to some modules
2. Each module should denote a major step
in overall process.
Object Oriented Decomposition
1. View the world as a set of autonomous
agents that collaborate to perform some
higher level behaviour.
7. OOP/AKN/Part_II/7
Functional decomposition
Main
Problem: No. of words in a file
getWordFromFile addToWordList
getWordList sortword checkWord
Sorted Words
Word List Flag
Words Words(prev,curr)
WordWord Words
getSortedWordList countDiffWords printResult
Sorted Words
Sorted Words
Count
Count
9. OOP/AKN/Part_II/9
Which is the Right way?
Algorithmic view highlights the ordering of
events
Object Oriented view emphasizes the agents
(objects) that either cause action or to be
acted upon
Both The Philosophy are important
If the system is Very large, Complex, to be
Extended, Maintained then choose OO
approach.
10. OOP/AKN/Part_II/10
Procedural Programming
With procedural programming,
you are able to combine
sequences of calling statements
into one single place.
A procedure call is used to invoke
the procedure. After the
sequence is processed, flow of
control proceeds right after the
position where the call was made
.
Main
Program
Procedure
11. OOP/AKN/Part_II/11
Now a program can be viewed as a
sequence of procedure calls.
The main program is responsible to pass
data to the individual calls, the data is
processed by the procedures and the
resulting data is presented.
Thus, the flow of data can be illustrated as a
hierarchical graph, a tree.
Procedural Programming
14. OOP/AKN/Part_II/14
Abstraction
An Abstraction denotes the Essential
characteristics of an object that
distinguishes it from all other kinds of
objects and thus defines sharply defined
conceptual boundaries, relative to the
perspective of the viewer.
…Grady Booch
16. OOP/AKN/Part_II/16
Abstraction(contd.)
It focuses on the outside view(interface) of an
object. Therefore, it serves to separate an
objects essential behaviour from its
implementation.
It is used to reduce complexity by ignoring some
aspect of a subject that are not relevant to the
current purpose.
Example : A MAP (is not an exact picture)
Only the essential features of an area are
shown
Unimportant features are ignored.
17. OOP/AKN/Part_II/17
Abstraction(contd.)
All Abstractions have static as well as dynamic
properties.
Example: A FILE
Static : Name, Size, Content
Dynamic: the value contained in static properties.
It is dynamic because a file may grow or shrink
in size
Its name and content may change
19. OOP/AKN/Part_II/19
Encapsulation(contd.)
It is the process of compartmentalising
the elements of an abstraction that
constitute its structure and behaviour.
…Grady Booch
• In this process we keep the properties (or
structure or states) and behaviour of an
object in one place bundeled together.
• It supports information hiding
i.e. hiding all the information that is
unnecessary to the outside world.
20. OOP/AKN/Part_II/20
Encapsulation
Encapsulation helps to achieve abstraction by
hiding the implementation of behaviours
It provides explicit barriers among different
abstractions
Example: Riding a Bike
• Most of the riders are ignorant about the detail
structure of an IC Engine.
• Changing gears on your bike need not require to
know “how the gear mechanism works” just need
to know which lever to move.
21. OOP/AKN/Part_II/21
Composition defines a has-a relationship
An organized collection of components
interacting to achieve a coherent, common
behavior
The automobile has a windshield.
It deals with a single, complex system as an
organization of more numerous but simpler
systems
Composition
22. OOP/AKN/Part_II/22
Composition (examples)
A human being consists of a respiratory
system, a circulatory system, an immune
system, a nervous systems, a skeletal
system, etc
An aircraft consists of a propulsion system, a
control system, a navigation system, etc
An operating system consists of a user
interface, a file system, a network system, a
memory management system, etc
24. OOP/AKN/Part_II/24
Plant is a part of Garden(whole) (Association)
Flower is a part of Plant(whole) (Aggregation)
• Garden permits different plants to be raised over
time.
• Replacing a plant does not change the identity of a
garden.
• Removing a Garden does not necessarily destroy all
of its plants
i.e. the life time of Plant(part) and Garden (whole) are
independent.
Example
25. OOP/AKN/Part_II/25
Inheritance is the most important is-a kind
of hierarchy
Inheritance helps to share the structure and
behaviour defined in one or more classes
…Grady Booch
i.e a sub-class inherits from one or more
super-classes and subclass is dependent
upon superclass
Inheritance
27. OOP/AKN/Part_II/27
Examples (Inheritance)
Mammal is a kind of Animal
Tiger is a kind of Mammal
Cheetah is a kind of Tiger
House is a kind of Tangible Asset
Quick sort is a kind of Sorting algo
Sub class?
Super Class?
29. OOP/AKN/Part_II/29
Inheritance(contd.)
It implies a Generalization/Specialization
hierarchy
i.e subclass specializes its superclass and
superclass generalizes its subclass
Its benefits are
Extensibility,Maintainability,Reusability,
Understandability,Abstraction, and
Substitutability
30. OOP/AKN/Part_II/30
Polymorphism
It is the property that allows to exhibit
different behaviours at different situations
Different objects respond differently to a
same message
Example: message draw
Circle responds with drawing a circle
Polygon responds with drawing a polygon
…
31. OOP/AKN/Part_II/31
Dynamic Binding
(Also called as Late binding) Code
associated with a given message will be
decided at run time
Helps achieving dynamic polymorphism
34. OOP/AKN/Part_II/34
Object
What we mean?
• Humans understand the world by
viewing it as composed of
autonomous, interacting objects.
• Examples: people, animals, phone,
desks, buildings, stairs, ...
35. OOP/AKN/Part_II/35
Which is an Object?
An object may be of any of the following
A Tangible and/or Visible thing
A Table, A Tiger, A Car
Something that may be apprehended
intellectually
A Bank Account, A Complex Number
Something towards which thought or action
is directed
A Date, Time
36. OOP/AKN/Part_II/36
Virtual Objects
Objects that live in programs only, you can
not see by eyes, feel by hand, smell by
nose, and taste by tongue.
Virtual objects are the basic components for
your object-oriented programs.
37. OOP/AKN/Part_II/37
Examples of Virtual Objects
Bank Account
Keeps balance; responds to messages to deposit,
withdraw, and get balance
Set
Elements can be added, deleted, queried for
presence.
GUI Window
Ultimately responsible for keeping contents of
window. Many operations possible including open,
close, maximize, minimize, move, etc.
38. OOP/AKN/Part_II/38
Every thing are Objects?
Some objects may be tangible but have fuzzy
physical boundaries(fog, river) may not
be(sometimes) considered as objects
Difficult to distinguish my fog from your fog
But in a weather map; a fog bank over odisha is a distinctly
different object than a fog bank over Maharastra
Beauty, color, emotions(love, anger) may be
considered as properties of objects rather than
objects.
A Man(an object) loves his wife(another object)
The Cat(an object) is gray
39. OOP/AKN/Part_II/39
Defining an Object
An object has state, behavior, and identity;
the structure and behavior of similar objects
are defined in their common class; the
terms instance and object are
interchangeable
… Grady Booch
40. OOP/AKN/Part_II/40
State
The State of an object encompasses all of the
properties(static property) of the object plus
the current value (dynamic properties) of
these properties.
… Grady Booch
Example: Object :A-320:IC878 (An Air Craft)
States: Fuel = 1000 lts
Temp = 75 oC
Pressure = 200 lbs
isStart = false
…
Dynamic
PropertiesStatic
Properties
41. OOP/AKN/Part_II/41
The state
The state shows the existence of an object
When a person is dead, he has no
functions, but their DS is still there if he is
not burnt.
Also called attributes, private space,
member variables, instance variables, data
members, structure of objects etc…
42. OOP/AKN/Part_II/42
Behavior
Example: Object :A-320:IC878
start(…) : if isstart is false, fuel x lts, …
run(…) : if isStart is true, …
fly(…) : …
stop(…) : if isStart is true, …
Similarly:
fly causes decreasing in fuel and increasing
in temperature i.e change of states
43. OOP/AKN/Part_II/43
Behavior
Behavior is how an object acts and reacts,
in terms of its state changes and message
passing.
… Grady Booch
Example: Object :A-320:IC878
start, run, fly, break, stop, turn …
Behavior of an object is influenced by its
state and vice versa
44. OOP/AKN/Part_II/44
Behavior / Method
A method is an operation an object can make
to respond relevant message.
A method is associated with a class. An
object invokes a method as a reaction to
receipt of a message.
When an object has no method, it is dead!
Also called member functions, operations,
behaviors or services.
45. OOP/AKN/Part_II/45
Message
A message is a request to an object to
invoke one of its methods. A message
therefore contains
the name of the method and
the arguments of the method.
Consequently, invocation of a method is just
a reaction caused by receipt of a message.
This is only possible, if the method is actually
known to the object.
46. OOP/AKN/Part_II/46
Message
integer i; /* Define a new object */
i.setValue(1); /* Set its value to 1 */
To express the fact, that the integer object i
should set its value to 1.
The message is “Apply method setValue with
argument 1” (sent to object i). We notate the
sending of a message with the help of .(dot)
47. OOP/AKN/Part_II/47
Identity
It is that property of an object which
distinguishes it from all other objects
… Grady Booch
Two objects may have same static and
dynamic properties. But the identity
differentiates them
Example:
SSN, EmpID, Slno, …
49. OOP/AKN/Part_II/49
Class(contd.)
It defines a set of objects that share a
common structure and behaviors
… Grady Booch
A class represents only an abstraction, the
essence of an object. It doesn't exist in time
and space
Example: Class Mammal represents the
characteristics common to all mammals
To identify a particular Mammal, we say
This Mammal or that Mammal
52. OOP/AKN/Part_II/52
Interface of a Class
The interface of a class provides its outside view
and therefore, emphasizes the abstraction while
hiding its structure and the secrets of its behavior
The interface primarily consists of the declarations
of all operations applicable to its instances
But it may also include the declaration of other
classes, constants, variables and exceptions as
needed to complete the abstraction
53. OOP/AKN/Part_II/53
Interface(contd.)
The Interface of a class may be divided
into three parts
1. Public: declaration that is visible to all the
world
2. Protected: declaration that is visible to the
class itself, its subclasses, and its friends
3. Private: declaration that is visible only to
the class itself and its friends.
Also called access specifiers
57. OOP/AKN/Part_II/57
Instantiation
The mechanism of creating new objects from a
class definition is called instantiation mechanism.
Every class has such a mechanism.
Static instantiation and Dynamic instantiation.
instantiation at compile time;
instantiation at run time.
Dynamic instantiation requires a run time support for
allocation and de-allocation of memory.
58. OOP/AKN/Part_II/58
Structure vs Class in C++
A structure is simply a class whose
members are public by default.
class Time{
int hour;
int min;
int sec;
public:
Time();
void setTime(int,int,int);
void printTime(void);
};
struct Time{
int hour;
int min;
int sec;
public:
Time();
void
setTime(int,int,int);
void printTime(void)};
Public by
default
Private by
default
59. OOP/AKN/Part_II/59
Other Definitions for Objects
Anything, real, or abstract, about which
we store data and those methods
(operations) that manipulate the data.”
…Martin/Odell
An object is an instance of a class. It can be
uniquely identified by its name and it defines a
state which is represented by the values of its
attributes at a particular time.
…Peter Müller
60. OOP/AKN/Part_II/60
Constructors
Constructor is used to initialize(reserves
memory as well as set values to the data
members) an object and it is recognized by
having the same name as the class.
Constructors can be overloaded i.e. there
may be more than one constructors for the
same class with several ways of initialization
Example: Time(), Time(int),
Time(int,int,int), …
61. OOP/AKN/Part_II/61
Constructors
Every time an object is created, one constructor
is invoked
Constructors with no arguments is known as the
default constructor
Constructor can‟t have a return type
It should always be declared in public part of the
class structure. (?)
If no constructor is provided by the programmer
then compiler provides one default constructor.
ClassName(){}
62. OOP/AKN/Part_II/62
Destructors
It is a special member function named same as the
class and preceded by a ~
Example:
class Time{
… public:
~Time();
}
It is used to free the state of an object
These are called implicitly when an automatic
object goes out of scope. But if an object is
initialized using new than it has to be deleted
In very unusual situations does the user need to
call a destructor explicitly!
63. OOP/AKN/Part_II/63
Design a class ComplexNum with Attributes
real (double), img (double) and
Member Functions
Default constructor, parameterized constructor
printComplex, addComplex
Write a main function in which three objects
are created.
Two of them using parameterized constructor, one
using default constructor.
Now add first two objects using addComplex
member function and store the result in third
complex number.
Finally print all the complex numbers.
64. OOP/AKN/Part_II/64
Complex number Program
class ComplexNum{
private:
double real; double img;
public:
ComplexNum(){real=img=0.0;}
ComplexNum(double r, double i){
real = r; img = i;
}
void printComplex();
ComplexNum addComplex(ComplexNum);
}; // end of class definition
67. OOP/AKN/Part_II/67
Constant Member Functions
int func(…) const;
const is a specifier, which specifies that, this
function will not modify the states of an object.
The value of the object can‟t be changed
The keyword is written after the parentheses
Example:
class Date{
private:
int d,m,y;
public:
int day()const{return d;}
int month()const{return m;}
68. OOP/AKN/Part_II/68
Constant Member Functions(contd.)
int year()const;
int addYear(int);
};// end of class definition
int Date::year() const{return y++;}
// Error: Attempt to change value of y
int Date::year() const{return y;}
// Ok
int Date::year() {return y;}
// Error: const keyword missing
int Date::addYear(int a){return y+a;}
// Ok
69. OOP/AKN/Part_II/69
Constant Member Functions(contd.)
• A constant member function can be invoked for
both constant and non-constant objects.
• A non constant member function can be invoked
only for non-constant objects.
Example:
void f(Date &d, const Date& cd){
int i=d.year(); // Ok (one)
int k=d.addYear(1); // Ok (two)
int l=cd.addYear(1); //Error (two)
int m=cd.year(); //Ok(two)
}
70. OOP/AKN/Part_II/70
Static Class Members
Static data member is an attribute that is a
part of class, yet is not a part of an object
In other words there is exactly one copy of a
static member instead of one copy per
object
A Function that needs access to members
of a class, yet does not need to be invoked
for a particular object is called static
member function
71. OOP/AKN/Part_II/71
Example Static data member
class Sclass{
int x, y;
static int z;
. . .
};
int Sclass::z;
main() {
Sclass o, p, q;
}
o
x y
p
x y
q
x y
z
72. OOP/AKN/Part_II/72
Example: Number of objects that are live in
any point of the program
class Employee{
char* name;
static int count; // static data memb.
public:
Employee(char*);
char* getName();
static int getCount(); // static memb. func
~Employee();
};
75. OOP/AKN/Part_II/75
Example (contd)
cout<<“no of employees: “
<<e1->getCount();
cout<<“Emp1: “<<e1->getName();
cout<<“Emp2: “<<e2->getName();
delete e1;
cout<<“no of employees: “
<<e2->getCount();
delete e2;
cout<<“no of employees: “
<<Employee::getCount();
}
76. OOP/AKN/Part_II/76
Static Class Members
Static data members are accessible by both static
and/or non-static member functions
Static member functions can only access the static
class members
To access a public static class member, simply
prefix the class name and scope resolution
operator
To access a private static class member, when no
object exists take help of a static member function
otherwise non-static could be used.
78. OOP/AKN/Part_II/78
Overloading Operators
Operator Overloading allows us to overload the
existing operators s.t. they can have operands as
objects
Complex C=A+B;//A & B are complex number objs
It doesn't provide any means to create new
operators
Some operators Can‟t be overloaded
Binary operators may be overloaded either by a
non-static member function having one argument
or a non-member function having two arguments
79. OOP/AKN/Part_II/79
Example: Distance class
class Distance{
int feet;
float inches;
public:
Distance():feet(0),inches(0.0){}
Distance(int f, float i):feet(f),
inches(i){}
void showDistance(){
cout<<feet<<„‟‟<<inches<<„”‟<<endl;}
Distance addDistance(Distance);
};
85. OOP/AKN/Part_II/85
Passing two args: a non member function
class Distance{
int feet;
float inches;
public:
Distance();
Distance(int, float);
void showDistance();
};
Distance operator+(Distance, Distance);
87. OOP/AKN/Part_II/87
A solution: with a non member function
class Distance{
int feet;
float inches;
public:
Distance();
Distance(int, float);
void showDistance();
int getFeet(){return feet;}
float getInch(){return inch;}
};
Distance operator+(Distance, Distance);
88. OOP/AKN/Part_II/88
Passing Two Args
Distance operator+(Distance d1, Distance d2){
int f=d1.getFeet()+d2.getFeet();
float i=d1.getInch()+d2.getInch();
if(i>=12.0){
i-=12.0;
f++;
}
return Distance(f,i);
}
Note: In one program, there should be only one
operator overloading function for each operator.
Remember that this
function should be a
non-member!
89. OOP/AKN/Part_II/89
Friend Function
A friend of a class is a function that is not a member of
the class but is permitted to use the private and
protected members of the class
The name of the friend is not in the scope of the class
and the friend is not called with the member access
operator
It can be declared in either private or public part of a
class
A friend is explicitly declared inside the class
declaration of which it is a friend
Key word is friend
92. OOP/AKN/Part_II/92
Overloading using friend function
class Distance{
int feet;
float inches;
public:
Distance();
Distance(int, float);
void showDistance();
friend Distance operator+(Distance,
Distance);
};
93. OOP/AKN/Part_II/93
Example (contd.)
Distance operator+(Distance d1, Distance
d1){
int f = d1.feet+d2.feet;
float i = d1.inches+d2.inches;
if(i>=12.0){
i-=12.0;
f++;
}
return Distance(f,i);
}
Legal
Accessing private data
members as it is a friend
function
95. OOP/AKN/Part_II/95
Example
Matrix Vector product
class Matrix;
class Vector{
float v[4];
…
friend Vector operator* (Matrix &,Vector &);
};
class Matrix{
Vector m[4];
…
friend Vector operator*(Matrix&, Vector&);
};
96. OOP/AKN/Part_II/96
Example (Contd.)
Vector operator *(Matrix& mat, Vector& vec)
{
Vector res;
for(int i=0;i<4;i++){
res.v[i]=0;
for(int j=0;j<4;j++)
res.v[i]+=mat.m[i].v[j]*vec.v[i]; }
return res;
}
//Complete the program and execute
97. OOP/AKN/Part_II/97
Task
Overlaod + and – operators for ComplexNum
class using non-member(friend) functions.
Design the class
Define functions
Main function
98. OOP/AKN/Part_II/98
A Comparison
Access to
private part
Inside
scope of
the class
Invoked with
reference to
an object
Member
function
Yes Yes Yes
Static -
member
Yes Yes Optional
Friend
function
Yes No No
99. OOP/AKN/Part_II/99
Unary Operators
A Unary operator can be defined by either a
member function taking no arguments or a
non-member function taking one argument
Example
class X{
operator ++(); //prefix
operator ++(int); //postfix
}
100. OOP/AKN/Part_II/100
Example (contd.)
The int argument is simply a dummy
argument. It is used to distinguish between a
prefix and postfix application
Example
void operator ++(int){//postfix
feet++;
}
void operator ++(){//prefix
++feet;
}
d1++; d1.showDistance( );
++d2; d2.showDistance( );
101. OOP/AKN/Part_II/101
Mixed mode overloading
How to execute when two operands are of
different type?
Complex c,c1;
double d;
c+=c1; c+=d; c=d+c1; c=c1+d;
Complex operator +=(Complex a){
re+=a.re;
im+=a.im;
return *this;
}
Member
function
106. OOP/AKN/Part_II/106
Operator overloading
istream& operator>>(istream& in,
Complex &c){
in>>c.re>>c.img;
return in;
}
These functions must be non members as
the objects of class Complex appears in
each case as the right operand and the
function can not be a part of class ostream
and istream
107. OOP/AKN/Part_II/107
Data Conversion
„=„ is a special operator with complex properties.
When both sides are of equal type, the compiler
does not need any special instructions to operate.
If they are different ?
Conversion between Basic Types:
(int)=(float); //allowed
Each such conversion has its own routine, built
into the compiler. This is called an implicit
conversion(casting).
108. OOP/AKN/Part_II/108
Data Conversion (contd.)
Sometimes we need explicit casting like
float ..= float(int ..)
This conversion also use the built-in routines
available with the compiler.
User Defined to Basic Types
float ..=float(Distance);
float f = d1;
Operator float(){
float ft=inches/12;
ft+=float(feet);
return ft;}
109. OOP/AKN/Part_II/109
Data Conversion(contd.)
Basic to User-defined type
Distance d1=2.35;
Distance(float f){
feet=int(f);
inches=12*(f-feet);
}
User-defined to User-defined type
objA=objB;//both are objects of
different classes
111. OOP/AKN/Part_II/111
Data Conversion(contd.)
operator Rect(){
double x=radius*cos(angle);
double y=radius*sin(angle);
return Rect(x,y);
} //inside class declaration
}; //class ends here
main(){
Rect rec; Polar pol(10.0,0.785398);
rec=pol;
pol.display(); rec.display();}
112. OOP/AKN/Part_II/112
Pitfalls/Guidelines of Data Conversion
Use Similar meanings
Use overload operators to perform similar
operations as in basic types
Use Similar Syntax
Don‟t try to create new operators also don‟t design
binary operators for unary action and vice versa
Show Restraint
Don‟t overload operators if not required frequently.
Also Limit the overloaded operators for a class to
manage complexity
113. OOP/AKN/Part_II/113
Pitfalls/Guidelines of Data Conversion
Avoid Ambiguity
Don‟t try to overload the same operator in many
different ways in a same program. This may be a
confusion for the compiler.
Not All operators can be overloaded.
*(pointer), .(access op), :: (scope),
?: (ternary), and sizeof()
114. OOP/AKN/Part_II/114
Copying Objects
class Table{
char *name;
float size;
public:
Table(float s=15){
name=new char[size=s];}
};
1.Table t1;
2.Table t2=t1;
3.Table t3;
4.t3=t2;
5.Table t4(t3);
Default Constructor
//constructor is called
//copy initialization
//constructor is called
//copy assignment
//copy constructor
115. OOP/AKN/Part_II/115
Copying Objects (contd.)
Line 1: default constructor is called and the
address for the memory allocated is stored in
name variable.
Line 2: It is initialized by copying. i.e memberwise
copying t2.name=t1.name;
Now both object point to same memory area.
Line 3: default constructor is called and the
address for the memory allocated is stored in
name variable.(t3.name)
Line 4: t3.name is overwritten by t2.name which is
nothing but t1.name
Line 5: . . .
116. OOP/AKN/Part_II/116
Copying Objects (contd.)
Conclusion:
1. Storage for t3 is lost to program for ever
2. All objects point to same memory area
3. Destructor will be called Four times(?)
i.e. the same memory area will be deleted four
times and the result is undefined( may be
disastrous!)
Also called as shallow copy
117. OOP/AKN/Part_II/117
Copy Constructors
Make a duplicate copy of an object of the
same class, the default make a
memberwise copy of the the object
The default Copy constructors is created by
the compiler automatically.
A local copy of the object is constructed
which may create anomalies.
Copy constructors can also be defined by
us, which can be designed meaning fully
according to the requirement.
120. OOP/AKN/Part_II/120
The “This” Pointer
Every object has access to its own address
through a pointer called „this‟
The this pointer is passed as an implicit first
argument on every non-static member
function call for an object.
The this pointer is implicitly used to refer both
the data and function members of an object
It can also be used explicitly;
Example: (*this).x=5; or this->x=5;
121. OOP/AKN/Part_II/121
Friend Classes
If a class is declared as friend to another class then
it is allowed to access all the members of that class
To declare class A as a friend of class B, place the
corresponding declaration in the definition of class
B.
Example:
class ClassOne{
...
friend ClassTwo;
};
Friendship is neither symmetric nor transitive.
ClassTwo is allowed to
access all the members of
ClassOne
122. OOP/AKN/Part_II/122
Nested Classes
Classes like blocks and namespaces can be
nested.
These are all scopes and nesting allows local
hiding of names and local allocation of
resources.
This is often the case when a class is
needed as part of the implementation of a
larger construct
124. OOP/AKN/Part_II/124
Local / Global classes
Class declared out of all scopes are called
global class.
These classes may be used to create
objects anywhere in the program.
Class declared inside a scope (function etc)
are called local class.
Objects of this class can be used inside the
specified scope only.
125. OOP/AKN/Part_II/125
A more complete example
class String{
int length;
char *ptr;
void setString(const char*);
public:
String(const char* = ““);
String(const String&);
~String();
String& operator=(const String&);
String& operator +=(const String &);
bool operator !()const;
bool operator ==(String&)const;
126. OOP/AKN/Part_II/126
Example (contd.)
bool operator <(String)const;
bool operator !=(String&)const;
bool operator >(String&)const;
bool operator <=(String&)const;
bool operator >=(String&)const;
char& operator[](int);
String operator()(int,int);
int getLength()const;
friend ostream& operator<<(ostream&, const
String&);
friend istream& operator>>(istream&,
String&);
}; //end of class def.
135. OOP/AKN/Part_II/135
Task
Design a class called LargeInt to handle integers
of large size (O(103 ) digits)
overload all arithmetic operators (+, -, *, /, %)
overload all unary (++, --, +=, . . .) operators
overload all relational operators
design copy constructor and copy assignment
Member function to test primality
Write a suitable main function to demonstrate all
above facilities
136. OOP/AKN/Part_II/136
Readings
Programming
Bjarne Stroustrup, The C++ Programming Language, PE
Lippman, Lajoie, C++ Primer, Addison-Wesley
B. Eckel, Thinking in C++, Vol I and Vol II
Deitel & Deitel, C++ How to program
Schildt, C++ The complete reference
S. Sahay, OOP with C++
E. Balagurusami, Object oriented programming with C++
Concepts
G.Booch, Object Oriented Analysis & Design
Bertand Meyer, Object Oriented Software Construction