1 Replies - 396 Views - Last Post: 22 November 2011 - 11:34 AM Rate Topic: -----

#1 iqbalmmz  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 92
  • Joined: 15-February 11

general c++ questions

Posted 22 November 2011 - 09:25 AM

Hi everyone

I have some basic c++ questions.

In definition of function members of a class, their names are qualified with the class name using which operator?
public and private?

What checks for the integrity of data that is used to populate the data members of a class? My guess is a class invariant? please tell me if I'm wrong.

Which constructor is used when an objects declaration does not supply initial values for the data members of an object whereas a [blank] constructor initializes then to specific values supplied in the objects declaration.
my guess is default constructor and explicit value constructor?

Functions can be overloaded provided they have different [blank]? no idea?

Two default copy operations provided for all classes are copy during [blank] and copy during [blank].
no idea?


An operator ^ can be overloaded by writing a function with the name [blank]. bool?

A [blank] function is a non-member function that can access a class’s data members.
friend? I believe this is correct, again please correct me if I am wrong

What is an ADT?
a collection of data items together with the operations on the data.


Define the private portion of a class to model the given item:
A class “Date” for dates consisting of a month, date and year.

private:
string myMonth;
string myDate;
string myYear;
Is this question really this straightforward?


Please correct me above, this is a study guide for an upcoming exam.

This post has been edited by iqbalmmz: 22 November 2011 - 09:28 AM


Is This A Good Question/Topic? 0
  • +

Replies To: general c++ questions

#2 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1150
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: general c++ questions

Posted 22 November 2011 - 11:34 AM

I'll help you with the harder ones. For each question, read the article carefully, the answers are there.

1. Incorrect. http://www.cplusplus...torial/classes/
2. I think it's: checking if the data is NULL. Not sure what your looking for here.
3. Correct. That question needs to be re-worded.
4. http://www.cplusplus...ial/functions2/
5. Initialization and assignment.
6. http://www.cplusplus...orial/classes2/
7. Correct.
8. That's an OK answer. A better one is this: "A model for a class of data structures that have similar behavior. The ADT is defined by the operations that may be performed on it."
9. Correct, although you may want to use integral types for each member.

private:
     int month, day, year;



Check back once you think you have the correct answers.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1