ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Basics of c++
BASICS OF C++
INTRODUCTION
• Developed by Bjarne Stroustrup
• Initially known as C with classes
• C + Simula 67  C++
Increment
operator
WHY C++
PROBLEMS WITH STRUCTURED PROGRAMMING:
Unrestricted Access to GLOBAL DATA
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.
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.
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
What is class???
Member variable
Member function
What is object???
Blueprint of a class
Instance of a class
Variable of type class
int rollno;
student S1;
Basic datatype
User-defined datatype
Basics of c++
Basics of c++
Basics of c++

More Related Content

Basics of c++

  • 3. INTRODUCTION • Developed by Bjarne Stroustrup • Initially known as C with classes • C + Simula 67  C++ Increment operator
  • 4. WHY C++ PROBLEMS WITH STRUCTURED PROGRAMMING: Unrestricted Access to GLOBAL DATA
  • 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
  • 8. What is class??? Member variable Member function
  • 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