II. C++ and Object-oriented programming

Part II: C++ and Object-oriented programming:

  1. Classes
  2. Inheritance
  3. Operator overloading
  4. Polymorphism
  5. Templates and introductory meta-programming
  6. The STL library
  7. Some design patterns and programming techniques

session 1

this is a draft writtin inside the class while it's running

Why C++

Object Oriented Concepts

in object oriented we don't think about procedures, we think about objects that interact together, we don't try to explore all paths that the logic may run through

Instance vs type

isa

  • abstraction/hiding made easier
  • Object behaviour modification: more goes here
  • Generic programming
    • type independance : more goes here
  • Inter-object interaction
    • design: more goes here

note about over architecting of a program.

References

  • an object naming: compiler handles it, it doesn't have to be a pointer. It's abstracting you from dealing with memory.
  • Declaration: in compiler messages it's called Lvalue
x=5;
int& ref=x;

you can't say it's ok to say but it's not useful to use it.

functions

  • Overloading:

you can overload the function as the function signature is different, you can redefine the function

  • function signature

includes the passed variables, and their types

differs from so when you call a function it depends on your passed variable to call which function. but you can always cast.

  • Default arguments:

only the last n arguments, not in the middle.. not that you already took to function signature, one takes int & chat, and one taking only int for example)

Scopes

  • namespace can be nested
{
  namespace y
    {
       int fun()
       .
       .
    }
}

Class

  • it's the central concept in C++
  • Class as object type