hi,
i know structures are basically used for holding data members whereas classes can hold both functions and data members.
but contrary to the definition of structures can they also hold functions??
i read that they can but there wasn't any explanation about it.
hopefully,some of few can come up with the explanation.

aCTUALLY in C language structures cannot hold functions.

But when u come to c++, there is very little difference between a structure and a class.

U can have functions in Structures in C++ and u can implement many OOPS concepts in structures, the same way as in a class, except few concepts ofcourse.

So the Bottom line is:
In C Structures cannot have functions
In C++ Structures can contain Functions.

Hope this helps

In C structures can hold pointers which can point to functions...So in a way, C structures can hold(point to) functions..

In C structures can hold pointers which can point to functions...So in a way, C structures can hold(point to) functions..

Yes! I forgot that.

thanx to all for your worthy answers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.