I have been programming for quite a while now but I am new to Arduino and AVR Programming. The main question I have about programming these Micro-controllers is are there major differences in designing code in Object Orientated Classes vs the more traditional inline programming I have seen in many examples?
In other words in the world of Arduino/AVR Controllers are there any savings with Memory and Performance utilizing classes or visa versa?
Say for example we have a Class:
class SomeClass(){
private:
int x;
int y;
public:
void foo();
void bar();
}
SomeClass thisClass;
thisClass.foo();
thisClass.bar();
Would there be any performance or memory gains designing the program in a more inline fashion like:
int x;
int y;
void foo(){ /*** Do something ***/};
void bar(){ /*** Do more stuff ***/};
I tried doing some searches on Stack Exchange and Google but couldn't find quite the answer I am looking for the closest thing I was able to find was this Stack Exchange Question.
The reason I am asking about this is I have a project that needs to be as light as possible and I am not clear how I should be designing my program in this environment.
Edit
Thank you for the answers, this has shed light on things. There is one thing that I am not quite clear about.
Say you have a class that you are designing that utilizes the u8glib as follows:
class UserInterface{
private:
U8GLIB_ST7920_128X64 Display;
public:
UserInterface();
}
How would you get around using "Dynamic Memory" like:
UserInterface::UserInterface(){
UserInterface::Display = U8GLIB_ST7920_128X64(LCD_E_PIN, LCD_RW_PIN, LCD_RS_PIN, U8G_PIN_NONE);
}