📝 Classes and Objects [7 Hrs]

Topics Covered:


🔹 1. Introduction to Classes and Objects

A class is a user-defined blueprint that describes the behavior and properties (data members and member functions) of objects. An object is an instance of a class.

🔸 Syntax:

class ClassName {
public:
    // properties (variables)
    // behaviors (functions)
};

🔸 Example:

#include <iostream>
using namespace std;

class Student {
public:
    string name;
    int roll;

    void display() {
        cout << "Name: " << name << ", Roll: " << roll << endl;
    }
};

int main() {
    Student s1;
    s1.name = "Ramesh";
    s1.roll = 7;
    s1.display();
    return 0;
}


🔹 2. Access Specifiers (public, private, protected)