CDCDAC Prep
C-CATSection B: C, C++, DSA, OS, Networking & AI•~3 min read

C++ and Object-Oriented Programming Study Notes

Topic 1 (Free Preview)

History & Classification of Languages; Difference between C and C++

Topic 1 notes are 100% free. Topics 2–10 are available on the CDACPrep app.

Open in App

Study Notes

Free high-yield revision notes for History & Classification of Languages; Difference between C and C++

History & Classification of Languages; Difference between C and C++

History & Classification of Languages

Evolution of Programming Languages

Classification of Programming Languages:

1.1 Procedure Oriented Programming (POP)

  • FORTRAN is the 1st POP Language
  • Examples: C, FORTRAN, PASCAL
  • Focus is on

procedures/functions (what to do)

  • Global data shared between functions → security risk
  • Programs structured as a series of function calls

Problems with POP:

  • Global data is accessible to all functions — no data security
  • Not

suitable for large, complex programs

  • Difficult to model real-world entities

1.2 Object Oriented Programming (OOP)

  • Simula is the 1st OOP Language (1960)
  • Smalltalk is the only PURELY OOP

Language

  • C++ is a partial OOP language (also procedural)
  • Examples: C++,

Smalltalk, Java, C#

  • Focus is on objects — data + behavior together

1.3 Object Based Programming

  • Ada is the 1st Object Based Language
  • Examples: Visual Basic, Ada, Modula-2

- Has objects but lacks inheritance and polymorphism

1.4 Rule Based Programming

  • Examples: PROLOG, LISP
  • Used in AI, logic programming

C++ History

YearEvent
1979Bjarne Stroustrup begins work on "C with Classes" at Bell Labs
1983Renamed "C++" (++ = increment, as extension of C)
1985First C++ compiler released (CFront)
1998C++98 — first ISO standard
2003C++03 — minor revision
2011C++11 — major update (auto, lambda, smart pointers, range-based for)
2014C++14 — minor additions
2017C++17 — structured bindings, if constexpr, std::optional
2020C++20 — concepts, ranges, coroutines, modules
2023C++23 — further additions

Difference between C and C++

C++ Enhancements over C

FeatureCC++
ParadigmProcedural onlyProcedural + OOP
Classesstruct (no methods)class (data + methods)
EncapsulationNoneYes (public/private/protected)
InheritanceNot supportedSupported
PolymorphismManual (function pointers)Virtual functions
New data typesNo bool typebool, reference type
Function overloadingNot supportedSupported
Operator overloadingNot supportedMost operators overloadable
Default argumentsNot supportedSupported
Inline functionsMacros onlyinline keyword
ReferencesNot supportedSupported
TemplatesMacros onlyFull templates (generics)
Exception handlingerrno, setjmptry-catch-throw
NamespacesNot supportedSupported
Input/Outputscanf/printfcin/cout (streams)
Memory managementmalloc/freenew/delete (with constructors)
STLNoYes (vector, map, string, etc.)
File extension.c.cpp

C++ Input/Output

cpp
#include <iostream>
using namespace std;

int main() {
    int x;

    // cin with extraction operator >>
    cout << "Enter a number: ";  // cout = console output; << = insertion operator
    cin >> x;                    // cin = console input; >> = extraction operator

    cout << "You entered: " << x << endl;

    // Multiple inputs
    int a, b;
    cin >> a >> b;
    cout << "Sum: " << a + b << endl;

    // String input
    string name;
    cout << "Enter name: ";
    cin >> name;       // stops at whitespace

    // String with spaces
    string fullname;
    cout << "Enter full name: ";
    getline(cin, fullname);    // reads entire line

    return 0;
}
Ready to test what you learned?

Practice 20 MCQs with Instant Explanations

Solve exam-level questions for C++ and Object-Oriented Programming with scoring, option checking, and detailed answers.

Go to Practice MCQs