Member Functions

So, I have this class called Bracket:

1
2
3
4
5
6
7
8
class Bracket
{
public:
    Bracket(string, location);
    string getdata() const;
private:
    string location;
};

The getdata should return the value of the attribute

I need help with writing the member functions for this class
Last edited on
Getter functions are simple. All they do is return the appropriate member variable.

1
2
3
string Bracket::getdata () const
{   return location;
}


BTW, you have an extraneous comma on line 4.

Oh thank you for noticing the comma. I'll be sure to fix that.

Also, any advice you can give to me on creating a derived class called Team which includes constructors that accepts that location from Bracket and the team name (which would be setup as a string for the class).
I don't think you want to derive Team from Bracket.

Using the IS A and HAS A rule, a Team IS not A Bracket.
A Bracket HAS A Team (actually two).
Topic archived. No new replies allowed.