Skip to content

led5150/Copy_Constructor_Assignment_Operator_Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy_Constructor_Assignment_Operator_Example

Demonstrates how to implement copy constructors and assignment overload operators.

To get started

First, open the ArrayPoint.h and ArrayPoint.cpp files and familiarize yourself with the interface and implementation. You'll find it is just two very simple representations of a point. One using integers, and another using an array.

Next, use the provided Makefile and simply type

make

This will compile and executatble called 'example'.

To run the program type

./example

What happens next

You'll see a bunch of output that doesn't mean much right away. That's okay! All will become clear once you open up the copy_con_assignment_op_example.cpp and follow the step by step guide.

It may be useful to have the .cpp file one one half of your screen and the output of the program on the other. Read the steps and follow allong with the output of the program to see what is happening.

How it works

The program starts off by not having a proper copy constructor, overloaded assignment operator implemented or destructor implemented. Fear not! They are actually typed out, but are commented out in the ArrayPoint.h and ArrayPoint.cpp files. Along the way, you will go and uncomment these functions, recomplie, and run again to see different results!

That's it! Hope this helps you understand the importance of these conventions!

About

Demonstrates uses and how to implement copy constructors and assignment overload operators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published