Questions on Classes
I have studied C and am just starting to study OOP in C++. I have read lesson 12 on Intro to Classes.
It seems that functions in C and classes in C++ are quite similar.
Both can carry out operations within themselves and the code of classes and functions can be reused. Both classes and functions may also require input data in order to carry out their operations right? So, what is the big difference between functions and classes?
Constructors are used for initializing variables. So if we have variables that do not need initialization, does that mean we need not have a constructor? Are there other uses for the constructor besides initialization?
I have also heard from many programming students that OOP programming is much more difficult than structured programming e.g C. Is this true?
OOP looks at the world as one would normally do so. There are objects that all have methods and properties. A well designed class is great. It's good design that trips up most people.
As for the similarities between functions and classes, I don't think that's going to help you. C++ has functions just like C. Just think of a class like any other thing. A dog has properties like age, breed, height, weight, etc. A dog has methods like eat, bark, make a mess, etc. I'd suggest Eckle's book Thinking in C++. It's free online.
You need to understand what is meant by the following terms that describe OOP classes
You'll probably learn them in that order, I'd guess. Once understand the basics of these, you'll be able to answer your own question.