A
A
Andrey Golubkov2016-11-13 18:27:12
OOP
Andrey Golubkov, 2016-11-13 18:27:12

What is generalization in c++?

Given the task:


Based on the PersonList class, make a generic List class that can store a list of data of any type.

What should be done in the assignment and what is generalization in c++ ?
I think that in the task you need to write a template class.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2016-11-13
@Android97

You think right.

1
15432, 2016-11-13
@15432

It seems that here the term "generalized" does not refer to the language. Just follow the example to make the same list, but for any data.
For example, here is a list item:

struct List
{
    struct List * next;
    struct List * prev;
    void * data;
    int dataType;
};

capable of storing data of any type (depending on the dataType, the data pointer will be interpreted differently)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question