A class groups related data and behavior into one type.

Class Intro

class_intro.cpp
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
#include <iostream>

class Rectangle {
public:
    int width;
    int height;

    int area() {
        return width * height;
    }
};

int main() {
    int width = ;
    int height = ;

    Rectangle card;
    card.width = width;
    card.height = height;

    std::cout << "width=" << card.width << std::endl;
    std::cout << "height=" << card.height << std::endl;
    std::cout << "area=" << card.area() << std::endl;
    return 0;
}
class A class definition describes the fields and functions that objects of that type can use.