TDT4102: Procedure and object oriented programming
Introduction
C++ is a programming language made by Bjarne Stroustrup with C as a basis. It was first known as C with classes.
Fundemental
Data types
Type | Size | Size |
int | 32 bit | 4 bytes |
double | 64 bit | 8 bytes |
float | 32 bit | 4 bytes |
char | 8 bit | 1 byte |
The size of the int type is implementation dependent (at least 16 bits), but is 4 bytes on all modern systems.
Object structures
Class
A class is a structure for defining a new object type.
class Car {
int seats, sylinders, year;
double engineVolume;
string make, model;
public:
void start();
void stop();
void accelerate(int dV);
}