Using and understanding of basic OOP concepts withing a program

I read through the class tutorial here on cplusplus.com but I am not getting the concepts of classes, objects, and string member functions down enough and I need some help doing that. Here's what I am needing help with so that I can understand all of these concepts:

1) What code can I use to access the string class in this program?
2) What code can I use so that I will be able to use string class member functions on it?
3) How does using the string class demonstrate encapsulation?
4) How can I use any 4 string member functions in this program?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  class Name { // created a class named name

    public:
        
    private:
        string firstName; 
        string lastName;
        string pseudoname;    
   
    }

int main {
    
    Name myFirstName, myLastName, myPseudoName; // created three string objects
    
}
1) You can write a public method on the class, which returns the value of a string. Typically, you would have methods like:

1
2
3
4
5
6
7
8
  class Name { // created a class named name

    public:
      std::string getFirstName() const;
      std::string getLastName() const;
      std::string getpseudoname() const;
// ...
}; // Note that class definitions have to end with a semicolon 


2) You call them just like any methods on a class. Presumably, you've covered this in your learning? If not, your textbook will explain it.

As for the rest... this looks like you're just dumping homework questions on us and asking us to answer them for you. We don't do that. Try to do this on your own, using the knowledge you've learnt. If there are specific questions you have once you've tried, then we'll help.
Last edited on
Okay, thank you. I will work harder on the programs and ask only for specific help with any challenge that I have. I definitely understand about you guys not doing anyone's homework for anyone. Yes, we had only one assignment on OOP. I didn't think about reading and studying the textbook at first. Thank you for bringing that to my attention. I will read and study those sections within the chapter that I can use today.
Topic archived. No new replies allowed.