Ad Code

What is object in Data Structure?

What is object in Data structure perspective? i see that here objects are being passed as argument.
also pointer concept is becoming complex
for example:
newnode->setnext(currentnode->getnext()) //please explain this.
im surprised , "data structure programming in c++"


Object is a programming concept, while implementing a data structure, you may use object and classes as tools.

Pointers are simple variables which store memory addresses instead of values, here we mostly use pointers of user define type (classes, like node class) instead of int, float, char etc..

In the statement newnode->setnext(currentnode->getnext()), newnode and currentnode are pointers of type node class while setnext and getnext are methods of node class. We know that when we access a member method of a class with object we use dot operator like obj.method(). And when we access a member method of a class with pointer then we use -> operator like obj->method().
Reactions

Post a Comment

0 Comments