C++ was developed by Bjarne Stroustrup as an extension of C with classes and objects. It allows for real-world modeling through classes that can represent objects with both attributes and behaviors. A class is a user-defined datatype that is similar to a structure but includes data hiding - data is private by default. An object is an instance of a class, representing a variable of a user-defined type like a class.
5. WHY C++
RealWorld Modelling
• In the physical world we deal with objects such as people and cars.
• Such objects aren’t like data and they aren’t like functions. Complex real-
world objects have both attributes and behaviour.
6. Examples of attributes (sometimes called characteristics) are,
for people - eye colour and job title;
Behaviour is something a real-world object does in response to some
stimulus.
If you ask your boss for a raise,
she will generally say yes or no.
7. What is class???
User defined datatype
Similar to structure datatype
Structure + Data Hiding ïƒ class
Data is private by default
Includes member variables and member functions in class definition
Hiding data from another
functions in order to avoid
unintentional modification
9. What is object???
Blueprint of a class
Instance of a class
Variable of type class
int rollno;
student S1;
Basic datatype
User-defined datatype