7 Replies - 261 Views - Last Post: 07 March 2018 - 11:36 PM Rate Topic: -----

#1 LavLuna   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-November 17

C++ Exam Review (Classes Help)

Posted 07 March 2018 - 09:35 AM

I'm studying/practicing for my C++102 first exam by practicing some good and although, I can put together decent code...I still feel a disconnect between actually understanding what I'm doing vs. blankly knowing where to put things. Right now, I'm working through classes and I've made a metaphor to help myself understand, so before committing to memory, I want to make sure I'm on the right track.

Okay:

so I would have | "Baking" represent a Class | "Oven, Pans, and Temperature" represent Data Members | "Add sugar, Increase heat, Mix ingredients etc.." represent Member Functions |

Thoughts?

Is This A Good Question/Topic? 0
  • +

Replies To: C++ Exam Review (Classes Help)

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 09:37 AM

I would think 'recipe' is the class. Ingredients as the variables.. actions like stir, pour, bake, etc as methods and functions.
Was This Post Helpful? 0
  • +
  • -

#3 LavLuna   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-November 17

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 09:38 AM

View PostLavLuna, on 07 March 2018 - 09:35 AM, said:

I'm studying for my C++102 first exam by practicing some code and although, I can put together decent code...I still feel a disconnect between actually understanding what I'm doing vs. blankly knowing where to put things. Right now, I'm working through classes and I've made a metaphor to help myself understand, so before committing to memory, I want to make sure I'm on the right track.

Okay:

so I would have | "Baking" represent a Class | "Oven, Pans, and Temperature" represent Data Members | "Add sugar, Increase heat, Mix ingredients etc.." represent Member Functions |

Thoughts?

Was This Post Helpful? 0
  • +
  • -

#4 LavLuna   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-November 17

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 09:45 AM

View Postmodi123_1, on 07 March 2018 - 09:37 AM, said:

I would think 'recipe' is the class. Ingredients as the variables.. actions like stir, pour, bake, etc as methods and functions.






mmmm yeah I see what you mean. That seems less convoluted. What if the class were "baking" and it held different types of baking as variables, and then the actions afterward would be member functions?
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 09:49 AM

I am not following that one.

Cars are also good. 'Car' is the class. Type, maker, wheels, engine, etc are properties. Functionality could be expressed in 'has gas' or 'drive'.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6216
  • View blog
  • Posts: 21,452
  • Joined: 05-May 12

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 11:41 AM

In general, classes are nouns, while class methods/functions are verbs.
Was This Post Helpful? 2
  • +
  • -

#7 Slyde   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 64
  • Joined: 11-February 18

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 07:48 PM

Well stated! +1
Was This Post Helpful? 0
  • +
  • -

#8 albert003   User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 492
  • Joined: 15-December 14

Re: C++ Exam Review (Classes Help)

Posted 07 March 2018 - 11:36 PM

Very simple.... Think of class as a Ford (The car company) and the objects as the different cars (Mustang, pick ups, sedans, etc) or....
Class could be the cake and the ingredients as the objects. Depending what ingredients you put into the cake you will make different kinds of cakes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1