Class initialisation is normally handled by the class constructor(s). Every constructor has an optional initialisation section between the declaration and the body of the constructor. This is generally used to call specific base class constructors, but can be used to initialise any member variables via their own constructors. Member variables may alternatively be initialised in the body of the constructor, but this is really only necessary when member pointers need to be allocated new memory. For those classes that have many members and many constructors, the initialisation may be handled by a private member method called by each constructor in order to simplify maintenance during development. However, when the class is finalised, the private member method will generally be replaced with formal initialisation sections in each constructor.
If you are asking about member functions. When we declare a function inside a class then that function becomes member function of that class and this function can access the whole class
you have to initialize it into the "Constructor" which is a function without dataType and it's name is the same with the class nameEX:-class Exforsys{private:int a,b;public:Exforsys();...};Exforsys :: Exforsys(){a=0;b=0;}the EX from : http://www.exforsys.com/tutorials/c-plus-plus/class-constructors-and-destructors-in-c.htmlI recommend this link for You Under the title "Constructors and destructors" :http://www.cplusplus.com/doc/tutorial/classes/You can also See : http://www.win.tue.nl/~maubach/university/education/online-references/cpp/swartz/notescpp/oop-condestructors/constructors.html
Private construction prevents objects from the class from being instantiated other than via a static member function of the class, a friend function or a friend class.
Nothing stops a member function from changing any of the values in a class. By convention, an accessor function is used to give read only access to class data, but that does not mean that it is prohibited from doing so. It is a member function, after all, and it has all the rights of any member function of the class.
A self-referential function in C++, or in any other supporting language, is a recursive function.
If you are asking about member functions. When we declare a function inside a class then that function becomes member function of that class and this function can access the whole class
you have to initialize it into the "Constructor" which is a function without dataType and it's name is the same with the class nameEX:-class Exforsys{private:int a,b;public:Exforsys();...};Exforsys :: Exforsys(){a=0;b=0;}the EX from : http://www.exforsys.com/tutorials/c-plus-plus/class-constructors-and-destructors-in-c.htmlI recommend this link for You Under the title "Constructors and destructors" :http://www.cplusplus.com/doc/tutorial/classes/You can also See : http://www.win.tue.nl/~maubach/university/education/online-references/cpp/swartz/notescpp/oop-condestructors/constructors.html
B. Class.
Private construction prevents objects from the class from being instantiated other than via a static member function of the class, a friend function or a friend class.
to define an additional task to an operator ,we must specify what it means in relation to the class to which the operator is applied.this is done with the help of a special function called operator function ,which describes the task.
Nothing stops a member function from changing any of the values in a class. By convention, an accessor function is used to give read only access to class data, but that does not mean that it is prohibited from doing so. It is a member function, after all, and it has all the rights of any member function of the class.
A self-referential function in C++, or in any other supporting language, is a recursive function.
The keyword is friend. The external function must be declared a friend of the class (from within the class itself) in order to become a member of the class and thus gain access to the private (and protected) members of the class.
-define class with necessary data member & member function. -create object of that class. -communication.
It is the first function that gets called when the program is executed.
There is no such thing. When declaring a friend function only the explicitly-scoped friend is granted private access. The friend function may well be declared virtual within its own class but none of its overrides are granted access unless they are explicitly granted access.
The keyword "friend" allows a function or variable to have access to a protected member inside a class.