classes and objects in cpp code example
Example 1: c++ classes
class SampleClass
{
int a;
public:
SampleClass(int v)
{
a=v;
}
int RetVal()
{
return a;
}
};
Example 2: C++ class
class Personnage
{
}; // N'oubliez pas le point-virgule à la fin !
Example 3: class in c++
class Name {
private:
int data;
public:
// Constructor
Name() {
// Code
}
int id;
void fun1(int a) {
// Some instructions here
}
}