Im a student and I faced a problem to understand the concept of single member pointers in object-orianted-programming (OOP) and I searched a lot on Google but did not got the idea!
Can you help me understanding it in details please?
Im a student and I faced a problem to understand the concept of single member pointers in object-orianted-programming (OOP) and I searched a lot on Google but did not got the idea!
Can you help me understanding it in details please?
So after further clarification from the comments, you seem to be wondering about pointer members in a class, like this:
Now pointers in classes are basically the same as normal variables, but since you are dealing with memory here, you will be 3 additional things (Rule of Three):
operator=I won't go too much into detail here, but it should look something like this:
Please learn about those three, called the Rule of Three, before you move on with pointers as attributes in a class.
And whenever you find yourself using pointers inside a class, you need to implement the Rule of Three.
Hope this helps :)