Classes and Objects - Tryhardtocarry/2143-oop GitHub Wiki

#include <iostream using namespace std; // a class user-defined blueprint from which objects are created. An object is an instance of a class, containing attributes (variables) and behaviors (methods/functions) Defining a class class Car { public: string make; string model;

// Constructor
Car(string m, string mod) {
    make = m;
    model = mod;
}

// Method to display car info
void display() {
    cout << "Car: " << make << " " << model << endl;
}

};

int main() { // Creating an object of the Car class Car car1("dodge", "hellcat");

// Calling a method
car1.displayInfo();

return 0;

}