kot1990 Expert Cheater
Reputation: 1
Joined: 06 Sep 2009 Posts: 131 Location: Greece
|
Posted: Mon Dec 14, 2009 5:45 pm Post subject: Inline functions, classes. |
|
|
We are learning about functions declared inside the class and outside the class. Our teacher just says it is a programming style and nothing changes at all. But I've read at cplusplus that when you include the body of the function inside the class, the function is inlined for every object of your class. I didn't know what inline function is, but as I understood, in the executable, when using inline, the program will not use any call to the function block, but will directly execute the code. So if I use many objects and my function is big, that would make copies of the function for every object?, my executable will grow big... isn't that true??
Edit: I don't want to create another thread so, I have 1 more question about classes. For what reason do access specifiers exist? Who are they trying to protect? I couldn't create a program that access specifiers would seem useful to me. Maybe they protect the memory from being written, like setting read only? And if I want to write the private variable?, or it is something like compiler protection against mistakes done by the programmer?
|
|