Why do we need classes, why can’t we just use structs?
Structs and classes alike can have both member variables and functions in C++. However, it cannot be assumed that a struct will clean up after itself (deallocating memory when no longer needed) in the same way as a class. Therefore a class should be used when member functions are required and structs only for member variables .
What are methods?
Methods is another word for member functions within a class.
How would you define a class?
class ClassName
{
public:
int m_variable1;
string m_variable2;
void method1()
{
}
};
What is an object?
An object is an instantiation of a class. It is the data structure that gets created by the compiler to the specification of its defined class. Multiple objects may be created from the same class with their own set of values.