Question: Good evening!

I'm a beginner programmer and am finishing up my first semester of C++. Currently I'm looking a final exam review sheet my professor gave us and I just don't understand exactly what it's asking me to do. I feel like if I saw an example I would get it immediately but as is I am rather lost.

Here's the review question.

```
Problem: Given the following class definition, implement the class methods. 

class CreditCard {
  public:
    CreditCard(string & no, string & nm, int lim, double bal = 0);
    string getNumber();
    string getName();
    double getBalance();
    int getLimit();
    // Does the card have enough to buy something?
    bool chargelt(double price); 
  private:
    string number;
    string name;
    int limit;
    double balance;
}; 

```

I know there isn't much context here, but let's just say in the context of this being a introductory C++ course, what is likely asking me to do/learn? I'm really not sure what "implement the class methods" means here, and while it may be something that I've seen already, more than likely it's just an issue I have with not understanding it in plain English.

And I suppose it can also be asked that: If you were to teach an beginner student with this code, what would you expect them to do with it or learn from it?

Any insight would be greatly appreciated =)

Answer: 
Strictly speaking, the C++ language doesn't have "methods". It has "member functions", and perhaps that's the terminology that you're more familiar with. But many other languages do use the term "method", so it's actually fairly common for C++ programmers to say "methods" when what they're really talking about is member functions. 

The class definition shows that the class defines four member functions:

```
string getNumber();
string getName();
double getBalance();
int getLimit();

```

The definition also shows that there is a constructor:

```
CreditCard(string & no, string & nm, int lim, double bal = 0);

```

A constructor is also a type of member function, but most people don't refer to constructors as "methods". Some probably do, though.

So, the instruction "implement the class methods" means: "write the code for the member functions `getNumber()` `getName()` `getBalance()` and `getLimit()`."

It might also mean "and write the code for the constructor, `CreditCard(string & no, string & nm, int lim, double bal)`", too.
This code is the definition of a class, the blueprint of an object. It is an introduction to the strong object-oriented programming of C++ and contains some key concepts.

You have the elements of a basic object. 

```
class CreditCard {
      public:
        // Constructor.(to construct an object).
        CreditCard(string & no, string & nm, int lim, double bal = 0);
        // Accessors (to access the attributes of the object).
        string getNumber();
        string getName();
        double getBalance();
        int getLimit();
        // Does the card have enough to buy something?
        /// A public method of the class.
        bool chargelt(double price); 
      private:
        // Attributes.
        string number;
        string name;
        int limit;
        double balance;
    }

```

The term *implement* means that you have to *create* the functions that you defined for the class. Usually, for each class, one will make a header file for the definition and a source file for the implementation, but you can make it on the same page too.

The implementation of a method can follow this template : 

```
string CreditCard::getNumber()
{
    return number; // Instructions as you're making a standard function.
}

```

For the constructor, it is important that you initialize the attributes of the object. So, in your implementation of the constructor, you have to associate the input parameters to the attributes. Notethat you don't need to return any value since the created object can be seen as the "returned value".