After reading it a few times i figured out how to access the member functions, still clueless on the private data head.
heres what i came up with.
Code:
#include<iostream>
using namespace std;
struct node
{
char c;
node* next;
};
class Newstring
{
public:
//constructor, copy constructor, overloaded operator== and destructor
void display() ;
unsigned length() const;
void concatenate(const Newstring&);
void concatenate(char);
bool substring(const Newstring&) const;
private:
node* head;
//other members if needed
//other functions if needed
};
void Newstring::display() //initializing Newstring memberfunction
{
// Here the private data can be, but how??? head is a pointer, but can u only access it by reference?
}
int main() {
Newstring a; // Creating Newstring object
a.display(); // invoking objects display member function
system("pause");
return 0;
}