Interesting Question

Why to use classes?

Why not just to write a simple program like this...


//includes


//prototypes


//functions


//void main

function1();

function2();


Q

Thank You


Comments

  • : Why to use classes?




    Convenience. C and C++ are both 'complete languages'. You can do anything in one that you can do in another.


    However, classes provide a simple and compiler-assisted way of dealing with inheritance, polymorphism, information hiding, and access protection, among other things. These are all implementable in C, but you have to do a lot of the grunge work yourself.


    If you don't know what these things are, I suggest you pick up a book on C++. You're right. You could write a program entirely without classes, or in fact without any C++ extension to the C language. Classes just come down to a language-supported convenience.






Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories