Click to See Complete Forum and Search --> : about classes ans structures


munigantipardhu
February 8th, 2009, 06:19 AM
structure supporting overloading ,inhertiance, virtual functions etcetc then what is the need of a classes. can any body clear me out.

laserlight
February 8th, 2009, 01:13 PM
This question does not sound particular to the Windows API, so I shall answer it more generally by pointing you to Stroustrup's answers to the FAQs:
What is so great about classes? (http://www.research.att.com/~bs/bs_faq.html)
What is "OOP" and what's so great about it? (http://www.research.att.com/~bs/bs_faq.html#oop)

Igor Vartanov
February 9th, 2009, 03:47 AM
structure supporting overloading ,inhertiance, virtual functions etcetc then what is the need of a classes. can any body clear me out.After taking an intent look at structures and classes and analysing similarities and differences the answer becomes obvious. You just found similarities. What about differences? ;)

0xC0000005
February 10th, 2009, 07:15 AM
According to my understanding, the only difference between a class and a structure in C++ is that the structure members are public by default and class members are private by default.

I think that the essence of munigantipardhu's question is "why this seemingly insignificant difference?" I have my own understanding but admit that I can't provide an authoritative answer.

Igor Vartanov
February 10th, 2009, 09:06 AM
The same to default inheritance.

But I would prefer to hear that from munigantipardhu. As well as the answer to this: why does member access protection seem like "insignificant" difference, as you failed even to notice that?