Let's take this snippet code :
class MyClass
{
public:
    int m_num;
    MyClass(int n) { m_num = n;}
}
If I create an object of this class the following way :
MyClass mc1(5);
MyClass mc2(mc1);
This calls to the default copy-constructor and it'll automatically assign mc2.m_num = mc1.m_num ? Also if there's a call inside the class which makes an instance the following way :
MyClass mc3(*this);
This will call to the default copy-constructor same as with mc2 the *this is just getting the object itself to be copied ?
Second problem I'm having is with compiling my code with Microsoft Visual Studio 2013. I've made a String class and when I try to compile I get lot's of linking error telling me that the functions are already defined for some reason. String.h :
#pragma once
class String
{
private:
    char* m_szStr;
    unsigned int m_length;
public:
    String(const char*);
    explicit String(unsigned int);
    String(const String&);
    ~String();
    String& operator=(const String&);
    bool operator==(const String&) const;
    String operator+(const String&) const;
    operator const char*() const;
    int findStr(char*) const;
    int getLen() const;
    void copyStr(const char*);
};
String.cpp:
#include "stdafx.h"
#include "String.h"
String::String(const char* pch)
{
    m_szStr = NULL;
    copyStr(pch);
}
String::String(unsigned int len)
{
    m_length = len;
    m_szStr = new char[m_length];
}
String::String(const String& that)
{
    copyStr(that.m_szStr);
}
String::~String()
{
    delete[] m_szStr;
}
String& String::operator=(const String& that)
{
    copyStr(that.m_szStr);
    return *this;
}
bool String::operator==(const String& that) const
{
    if (m_length != that.m_length)
        return false;
    for (unsigned int i = 0; i < m_length; i++)
    {
        if (m_szStr[i] != that.m_szStr[i])
            return false;
    }
    return true;
}
String String::operator+(const String& that) const
{
    String temp(m_length + that.m_length - 1);
    unsigned int offset = m_length;
    for (unsigned int i = 0; i < that.m_length; i++)
    {
        temp.m_szStr[offset] = that.m_szStr[i];
    }
    return temp;
}
String::operator const char*() const
{
    return m_szStr;
}
int String::findStr(char* pch) const
{
    unsigned int offset = 0;
    unsigned int strIndex = -1;
    for (unsigned int i = 0; m_szStr[i] != NULL && pch[offset] != NULL; i++)
    {
        if (m_szStr[i] == pch[offset])
        {
            if (strIndex == -1)
                strIndex = i;
            offset++;
        }
        else
        {
            strIndex = -1;
            offset = 0;
        }
    }
    return strIndex;
}
int String::getLen() const
{
    unsigned int len = 0;
    for (unsigned int i = 0; m_szStr[i] != NULL; i++)
    {
        len++;
    }
    return len;
}
void String::copyStr(const char* pch)
{
    if (!m_szStr)
        delete[] m_szStr;
    unsigned int pchLen = 0;
    for (unsigned int i = 0; pch[i] != NULL; i++)
    {
        pchLen++;
    }
    m_length = pchLen;
    m_szStr = new char[m_length];
    for (unsigned int i = 0; i < m_length; i++)
    {
        m_szStr[i] = pch[i];
    }
}
Code file:
#include "stdafx.h"
#include <iostream>
#include "String.cpp"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])s
{
    String s1("Hi!");
    String s2(5);
    s2 = "Hello, Hi!";
    const char* pch = static_cast<const char*>(s2);
    cout << pch << endl;
    return 0;
}
errors:
Error   1   error LNK2005: "public: __thiscall String::String(class String const &)" (??0String@@QAE@ABV0@@Z) already defined in assignment4.obj    C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   2   error LNK2005: "public: __thiscall String::String(unsigned int)" (??0String@@QAE@I@Z) already defined in assignment4.obj    C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   3   error LNK2005: "public: __thiscall String::String(char const *)" (??0String@@QAE@PBD@Z) already defined in assignment4.obj  C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   4   error LNK2005: "public: __thiscall String::~String(void)" (??1String@@QAE@XZ) already defined in assignment4.obj    C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   5   error LNK2005: "public: class String & __thiscall String::operator=(class String const &)" (??4String@@QAEAAV0@ABV0@@Z) already defined in assignment4.obj  C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   6   error LNK2005: "public: bool __thiscall String::operator==(class String const &)const " (??8String@@QBE_NABV0@@Z) already defined in assignment4.obj    C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   7   error LNK2005: "public: __thiscall String::operator char const *(void)const " (??BString@@QBEPBDXZ) already defined in assignment4.obj  C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   8   error LNK2005: "public: class String __thiscall String::operator+(class String const &)const " (??HString@@QBE?AV0@ABV0@@Z) already defined in assignment4.obj  C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   9   error LNK2005: "public: void __thiscall String::copyStr(char const *)" (?copyStr@String@@QAEXPBD@Z) already defined in assignment4.obj  C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   10  error LNK2005: "public: int __thiscall String::findStr(char *)const " (?findStr@String@@QBEHPAD@Z) already defined in assignment4.obj   C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   11  error LNK2005: "public: int __thiscall String::getLen(void)const " (?getLen@String@@QBEHXZ) already defined in assignment4.obj  C:\Users\****\Desktop\C++ Programming\assignment4\assignment4\String.obj    assignment4
Error   12  error LNK1169: one or more multiply defined symbols found   C:\Users\****\Desktop\C++ Programming\assignment4\Debug\assignment4.exe 1   1   assignment4
 
     
    