2 Replies - 493 Views - Last Post: 25 January 2017 - 07:05 AM Rate Topic: -----

#1 hoatvu1994  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 05-March 16

Having trouble with how to use constructor in C++

Posted 24 January 2017 - 11:45 PM

Hello there,

I have a little trouble with how to use the constructor in C++. In the sample program, my code supports to shows Professor Sonny after the sentence "CRC grade book instructor name is: "

My program shows everything except "Professor Sonny"

In the book, it teaches me how to use the constructor but with only one of parameter type string. However, in the source files, my professor want to create a grade that has two parameter type string. Therefore, I ended up add another std::string into the constructor called instructor_Name. However, I do not know which code that I should add in the GradeBook.cpp file, so it will show up the missing "Professor Sonny"

Attached image(s)

  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: Having trouble with how to use constructor in C++

#2 hoatvu1994  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 05-March 16

Re: Having trouble with how to use constructor in C++

Posted 25 January 2017 - 12:19 AM

I found out where am I missing, so I don't need anyone to reply. Thank for reading my post
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 6164
  • View blog
  • Posts: 21,248
  • Joined: 05-May 12

Re: Having trouble with how to use constructor in C++

Posted 25 January 2017 - 07:05 AM

Glad you found a solution.

In the future, please do not post screenshots of your code. Instead paste your code into the post body, then select it all, and press the [ CODE ] button on the toolbar.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1