[Help]2 Questions

Posts 1–4 of 4 · Page 1 of 1
[Help]2 Questions
1.

Is there a function to delete the program once it have been ended?

Example:
Code:
#include <iostream>

using namespace std;

int main();
{
       cout << "Test" << endl;
       AutoDelete; //False function
       return 0;
}
Is there a function similar to AutoDelete?

2.

Why in an operator= we need to return this?

example :

Code:
Duree Duree::operator=(const Duree &duree)
{
    // code

    return *this;
}
Thank u

For number 1.
system("del *path of program here*");


For number 2.

im pretty sure you wouldnt have to use that if you didnt make such a simple mistake

[php]#include "Duree.h"

Duree:uree(int heures, int minutes, int secondes)
} //<---------WTF
m_heures = heures;
m_minutes = minutes;
m_secondes = secondes;

if (m_secondes >= 60)
{
while (m_secondes >= 60)
{
m_seconde -= 60;
m_minutes += 1;
}

}

if (m_minutes >= 60)
{
while (m_minutes)
{
m_minutes -= 60;
m_heures += 1;
}

}

}
[/php]
Quote Originally Posted by Kallisti View Post

For number 1.
system("del *path of program here*");


For number 2.

im pretty sure you wouldnt have to use that if you didnt make such a simple mistake

[php]#include "Duree.h"

Duree:uree(int heures, int minutes, int secondes)
} //<---------WTF
m_heures = heures;
m_minutes = minutes;
m_secondes = secondes;

if (m_secondes >= 60)
{
while (m_secondes >= 60)
{
m_seconde -= 60;
m_minutes += 1;
}

}

if (m_minutes >= 60)
{
while (m_minutes)
{
m_minutes -= 60;
m_heures += 1;
}

}

}
[/php]
I know ^^

But plz Why a

Code:
return *this;
??
1. No, you can't because the system can't delete a file in use.
2. So that you can do:
Code:
Duree d1;
Duree d2;
Duree d3 = d2 = d1;
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us