Click here to Skip to main content
15,899,935 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 20:46
Victor Nijegorodov17-Oct-18 20:46 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 20:49
jung-kreidler17-Oct-18 20:49 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 21:07
Victor Nijegorodov17-Oct-18 21:07 
AnswerRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 21:22
jung-kreidler17-Oct-18 21:22 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 23:51
Victor Nijegorodov17-Oct-18 23:51 
QuestionCalculating decimal places - Pin
ptr_Electron16-Oct-18 1:56
ptr_Electron16-Oct-18 1:56 
AnswerRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 2:05
mveRichard MacCutchan16-Oct-18 2:05 
AnswerRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 2:26
ptr_Electron16-Oct-18 2:26 
GeneralRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 3:40
mveRichard MacCutchan16-Oct-18 3:40 
SuggestionRe: Calculating decimal places - Pin
David Crow16-Oct-18 2:47
David Crow16-Oct-18 2:47 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 2:52
ptr_Electron16-Oct-18 2:52 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:03
ptr_Electron16-Oct-18 3:03 
GeneralRe: Calculating decimal places - Pin
David Crow16-Oct-18 3:06
David Crow16-Oct-18 3:06 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:14
ptr_Electron16-Oct-18 3:14 
QuestionRe: Calculating decimal places - Pin
David Crow16-Oct-18 3:20
David Crow16-Oct-18 3:20 
AnswerRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:29
ptr_Electron16-Oct-18 3:29 
GeneralRe: Calculating decimal places - Pin
David Crow16-Oct-18 3:38
David Crow16-Oct-18 3:38 
GeneralRe: Calculating decimal places - Pin
leon de boer16-Oct-18 15:28
leon de boer16-Oct-18 15:28 
QuestionRe: Calculating decimal places - Pin
CPallini16-Oct-18 2:48
mveCPallini16-Oct-18 2:48 
AnswerRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 2:55
ptr_Electron16-Oct-18 2:55 
GeneralRe: Calculating decimal places - Pin
CPallini16-Oct-18 3:11
mveCPallini16-Oct-18 3:11 
QuestionUsing assignment operator = for a class with const memeber variables? Pin
Member 140109547-Oct-18 12:52
Member 140109547-Oct-18 12:52 
I'm doing an assignment and it was told that SIZE of the array has to be const and also that I will need to create an assignment operator, but idk maybe my lecturer didn't think about it?
I have this code:
class NameList
{
private:
  const int SIZE; // Size of the array
  string* mp_list; //points to the start of the array
...

And then there's assignment operator
NameList NameList::operator = (const NameList &otherList)
{
  SIZE = otherList.SIZE; // DOES NOT WORK

  delete[] mp_list;
  mp_list = new string[SIZE]; // Creating an array with a new size

  *mp_list = *otherList.mp_list; // copying content of the other array
}


This will not work since you can't change const. But it's bad if I don't change the SIZE variable. Is there a way to create an assignment operator with const variable? Or is it ok if the size of the array is not const or it's bad programming? What would you do?
AnswerRe: Using assignment operator = for a class with const memeber variables? Pin
CPallini7-Oct-18 20:36
mveCPallini7-Oct-18 20:36 
AnswerRe: Using assignment operator = for a class with const memeber variables? Pin
Richard MacCutchan7-Oct-18 21:47
mveRichard MacCutchan7-Oct-18 21:47 
AnswerRe: Using assignment operator = for a class with const memeber variables? Pin
«_Superman_»9-Oct-18 1:51
professional«_Superman_»9-Oct-18 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.