copy-constructor

Problem with const qualifiers to get private atributes of an object

I'm a completely new to C++ and I'm having a very stupid problem. I have a Graph class and I need to create a copy constructor for it. This is my class: #include <igraph.h> #include <iostream> using namespace std; class Graph { public: Graph(int N); // contructor ~Graph(); // destructor Graph(const Graph& other); // Copy ...

Correct way to duplicate Delphi object

What are pros and cons of duplication an object instance with constructor or instance function? Example A: type TMyObject = class strict private FField: integer; public constructor Create(srcObj: TMyObject); overload; //alternatively: //constructor CreateFrom(srcObj: TMyObject); property Field: integer read ...