Topics Covered:
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;
}