In the code of Linked List as stack above it is given “private Linked List queue” as data member in the class “LL_AS_stack” . This data member/ variable is itself a class “Linked List” in the previous section created. Is it possible to use a class as a data member.
Regarding class and data member LL in specific
We are using an object of the previously made Linked List class, as a data member for the new class LL_AS_stack.
We can use an object of previously made class as our data member.
We can also define a class inside another class.
Ex. We defined node class inside the LinkedList Class.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.