The document is a presentation on pointers and RAII in C++. It covers topics like pointers, dynamic allocation, exceptions, copying/assignment/destruction, RAII, and smart pointers. For pointers, it discusses how they store addresses and can be used to access and modify values indirectly. Dynamic allocation using new/delete is covered, noting objects persist until deleted. Exceptions are introduced as a non-ignorable signal for errors. Copying/assigning classes requires special constructor and operator functions. RAII ties resource acquisition to object lifetime through constructor/destructor. Finally, smart pointers like unique_ptr and shared_ptr are presented as safer alternatives to raw pointers.
In this core java training session, you will learn Elements of Java programming. Topics covered in this session are:
• Elements of Java programming language
• Conditional Statements
• Loops
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
TMPA-2017: Static Checking of Array Objects in JavaScriptIosif Itkin
TMPA-2017: Tools and Methods of Program Analysis
3-4 March, 2017, Hotel Holiday Inn Moscow Vinogradovo, Moscow
Static Checking of Array Objects in JavaScript
Astrid Younang, Lunjin Lu, Nabil Almashfi, Oakland Univerity
For video follow the link: https://youtu.be/eZC2x-Qf93I
Would like to know more?
Visit our website:
www.tmpaconf.org
www.exactprosystems.com/events/tmpa
Follow us:
https://www.linkedin.com/company/exactpro-systems-llc?trk=biz-companies-cym
https://twitter.com/exactpro
In this core java training session, you will learn Elements of Java programming. Topics covered in this session are:
• Elements of Java programming language
• Conditional Statements
• Loops
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
TMPA-2017: Static Checking of Array Objects in JavaScriptIosif Itkin
TMPA-2017: Tools and Methods of Program Analysis
3-4 March, 2017, Hotel Holiday Inn Moscow Vinogradovo, Moscow
Static Checking of Array Objects in JavaScript
Astrid Younang, Lunjin Lu, Nabil Almashfi, Oakland Univerity
For video follow the link: https://youtu.be/eZC2x-Qf93I
Would like to know more?
Visit our website:
www.tmpaconf.org
www.exactprosystems.com/events/tmpa
Follow us:
https://www.linkedin.com/company/exactpro-systems-llc?trk=biz-companies-cym
https://twitter.com/exactpro
This is talk is about what remains after more than one year of learning about Functional Programming, Category Theory, Lambda Calculus, Javaslang and some Haskell and Scala too.
I work with Apache Spark in Java8 & Javaslang. It’s a distributed computation context that works with large quantities of data.
I started my journey into Functional Programming to reduce the complexity of my code.
This is talk is about what remains after more than one year of learning about Functional Programming, Category Theory, Lambda Calculus, Javaslang and some Haskell and Scala too.
I work with Apache Spark in Java8 & Javaslang. It’s a distributed computation context that works with large quantities of data.
I started my journey into Functional Programming to reduce the complexity of my code.
Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice exp
This talk introduces the core concepts of functional programming, why it matters now and how these principles are adopted for programming.
Beyond the usage of the functional principles for programming in the small, their applicability to the design of components and further on to the architecture of software systems is also explored along with relevant examples.
The code samples used in the talk are in Haskell / Java 8 / Scala / Elm and JavaScript, but deep understanding of any of these languages are not a pre-requisite.
A minimal collection of most wanted and widely accepted idioms and coding conventions for C++ development presented with examples and explanations. The lecture targets performance oriented codes so emphasis is on performance-friendly techiques.
Topics covered:
1) Design issues: idioms and best practices
- Resource Aquisition Is Initialization (RAII)
- Ownership semantics and smart pointers
- Header files: dependencies and decoupling
2) Objects Construction/Destruction/Copying
- Designing constructors
- Rule Of Three
- Transactional programming
3) Namespaces
- ADL/Koenig Lookup
4) Static analyzers
In this chapter we will discuss exceptions in the object-oriented programming and in Java in particular. We will learn how to handle exceptions using the try-catch construct, how to pass them to the calling methods and how to throw standard or our own exceptions using the throw construct.
This presentation is a great introduction to both fundamental programming con...rapidbounce
This presentation is for everyone who wishes to understand the Python programming language from the ground up!
It is an excellent start to learn Python and create everything from web development to software development and scientific applications.
This is talk is about what remains after more than one year of learning about Functional Programming, Category Theory, Lambda Calculus, Javaslang and some Haskell and Scala too.
I work with Apache Spark in Java8 & Javaslang. It’s a distributed computation context that works with large quantities of data.
I started my journey into Functional Programming to reduce the complexity of my code.
This is talk is about what remains after more than one year of learning about Functional Programming, Category Theory, Lambda Calculus, Javaslang and some Haskell and Scala too.
I work with Apache Spark in Java8 & Javaslang. It’s a distributed computation context that works with large quantities of data.
I started my journey into Functional Programming to reduce the complexity of my code.
Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice exp
This talk introduces the core concepts of functional programming, why it matters now and how these principles are adopted for programming.
Beyond the usage of the functional principles for programming in the small, their applicability to the design of components and further on to the architecture of software systems is also explored along with relevant examples.
The code samples used in the talk are in Haskell / Java 8 / Scala / Elm and JavaScript, but deep understanding of any of these languages are not a pre-requisite.
A minimal collection of most wanted and widely accepted idioms and coding conventions for C++ development presented with examples and explanations. The lecture targets performance oriented codes so emphasis is on performance-friendly techiques.
Topics covered:
1) Design issues: idioms and best practices
- Resource Aquisition Is Initialization (RAII)
- Ownership semantics and smart pointers
- Header files: dependencies and decoupling
2) Objects Construction/Destruction/Copying
- Designing constructors
- Rule Of Three
- Transactional programming
3) Namespaces
- ADL/Koenig Lookup
4) Static analyzers
In this chapter we will discuss exceptions in the object-oriented programming and in Java in particular. We will learn how to handle exceptions using the try-catch construct, how to pass them to the calling methods and how to throw standard or our own exceptions using the throw construct.
This presentation is a great introduction to both fundamental programming con...rapidbounce
This presentation is for everyone who wishes to understand the Python programming language from the ground up!
It is an excellent start to learn Python and create everything from web development to software development and scientific applications.
Dynamic Memory Allocation, Pointers and Functions, Pointers and StructuresSelvaraj Seerangan
After go through this ppt the learners could be able to know the c programming concepts like dynamic memory allocation, pointers and functions and pointers to structures with examples.
Industry - Program analysis and verification - Type-preserving Heap Profiler ...ICSM 2011
Paper: Type-preserving Heap Profiler for C++
Authors: József Mihalicza, Zoltán Porkoláb and Ábel Gábor
Session: "Industry Track Session 4: Program analysis and Verification"
JavaScript and popular programming paradigms (OOP, AOP, FP, DSL). Overview of the language to see what tools we can leverage to reduce complexity of our projects.
This part goes over language features and looks at OOP and AOP with JavaScript.
The presentation was delivered at ClubAJAX on 2/2/2010.
Blog post: http://lazutkin.com/blog/2010/feb/5/exciting-js-1/
Continued in Part II: http://www.slideshare.net/elazutkin/exciting-javascript-part-ii
Documentation: https://izumi.7mind.io/latest/release/doc/distage/
Github: https://github.com/pshirshov/izumi-r2
Pavel Shirshov - DIStage: purely functional programming without sacrificing modularity with modern dependency injection for Scala
- Modularity and its importance
- DI-like mechanisms and their issues in Scala
- Why people think that "DI doesn't compose with functional programming", and why that's not true
- Designing a staged DI, for wiring at runtime, at compile-time, or mixed
- Staging programs for reliability, power and performance
- The pains of supporting rich Scala types (incl. How to emulate kind-polymorphism in Scala 2)
- Garbage collection in DI for better tests and deployments
Pavel's bio: Language-agnostic software engineer, coding for 18 years,
10 years of hands-on commercial engineering experience.
Led a cluster orchestration team at Yandex, "the Russian Google"; implemented an internal orchestration solution, "ISS" (Scala/Java/C++), managing 50K+ physical hosts across 6 datacenters.
Today, Pavel owns Irish R&D company Septimal Mind.
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...Sagar Verma
OOPS and its application in Java, Super class AND This Keyword,Java Bean, POJO ,Memory management in Java ,Packages ,Miscellaneous (Var-Args, toString(), Double equals operator(==))
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Ovidiu Farauanu
Discussing Design Patterns and OOP popularity,
Multithreading and OOP,
Functional Design for Multithreaded programming
and how Multithreading does not mean always concurency but multicore paralelism.
The .NET garbage collector can be your best friend or your worst enemy; and it’s not friendly with a lot of people. The GC left more than a few production systems burning in smoke after developers failed to anticipate the effects of real production loads on the memory subsystem. In this talk, we will methodically measure and improve the .NET garbage collector’s performance. We will begin with a quick refresher on dynamic performance tools that can identify GC issues: CLR performance counters, ETW GC events, and ETW object allocation events; as well as static analysis tools, such as the Roslyn-based heap allocations analyzer. Then, we will inspect multiple issues at the source code level: excessive boxing, unintended effects of lambdas closing over local variables, await-generated state machines, intermediate objects in LINQ queries, and many others. We will also discuss higher-level memory problems: how to get rid of large object allocations, how to avoid finalization, and how to convert heap-based designs to local objects. Some of these ideas are now being applied at the language and framework level in C# 7 and .NET Core. At the end of the talk, you will be equipped to reduce memory traffic and GC overhead in your own applications, often by a factor of 10 or more!
Keynote in KLEE workshop on Symbolic Execution 2018
Systematic greybox fuzzing inspired by ideas from symbolic execution, work at NUS
Covers new usage of symbolic execution in automated program repair, work at NUS
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
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.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
13. Lesson 2: Dynamic Allocation
• Objects have scope, and go away when execution reaches
the end of that scope
void f()
{
NamedRectangle fred_rectangle{ "Fred", 3, 4 };
// . . .
}
• What if other code needed that object still?
14. The Free Store
• Separate area of memory
• Objects created there stick around until deliberately cleaned
up
• To create one, use new – returns a pointer
• To clean up, use delete
18. Exceptions
• Sometimes what you want can’t be done
– That file doesn’t exist any more
– You don’t have permission to do that to the system
• Checking in advance is best, but not always possible
• Code that calls a function doesn’t need to check return value
• C++ provides a non ignorable signal that something awful
has happened
• Will return from any nested level of function calls to a place
that can handle the error
24. Copying, Assignment, and Destruction
• Copying a class-type object invokes a special constructor
– Called the copy constructor
– Rectangle(Rectangle const&);
– If you don’t define one, the compiler provides one by default
• The default behaviour is to copy each base and data
member
25. Copying, Assignment, and Destruction
• Copying a class-type object invokes a special constructor
– Called the copy constructor
– Rectangle(Rectangle const&);
– If you don’t define one, the compiler provides one by default
• The default behaviour is to copy each base and data
member
Rectangle(Rectangle const& other)
: _width{other._width}, _height{other._height}
26. Copying, Assignment, and Destruction
• Assigning to a class-type object invokes a special operator
– Called the assignment operator
– Rectangle& operator=(Rectangle const&);
– If you don’t define one, the compiler provides one by default
• The default behaviour is to assign each base and data
member
27. Copying, Assignment, and Destruction
• Assigning to a class-type object invokes a special operator
– Called the assignment operator
– Rectangle& operator=(Rectangle const&);
– If you don’t define one, the compiler provides one by default
• The default behaviour is to assign each base and data member
Rectangle& operator=(Rectangle const& other)
{
_width = other._width;
_height = other._height;
return *this;
}
28. Copying, Assignment, and Destruction
void f()
{
int x{1}; // x comes into existence
int y{2}; // y comes into existence
}
// y goes out of existence
// x goes out of existence
29. Destructor
• Name is always ~ plus the name of the class
– E.g., ~Rectangle()
• Returns nothing, takes no parameters
• Place to cleanup resources used by an object
– Close a file
– Release a lock
– Etc
• When exceptions transfer execution out of a scope,
everything declared in that scope is cleaned up
– Destructor runs
31. Smart pointers
• unique_ptr if only one object needs access to the underlying
pointer
• shared_ptr if several want to use the same underlying pointer
– Cleaned up when the last copy goes out of scope
• In <memory> header file
• If you’re using new or delete, you’re doing it wrong
32. RAII in General
• Constructor acquires resource
– Eg opens file
• All other member functions know resource is acquired
– Do not need to test and make sure
• Destructor releases resource
– Works even in the presence of exceptions