On Jan 29, 3:32 am, "Alf P. Steinbach" <a...@start.no> wrote:
> * BeautifulMind:
> > As per the C++ standard, after the compilation of the following class
> > "Test" how many / which members would be generated by the compiler.
> > and actually I am also interested behind the logic doing so by C++ for
> > this empty class "Test" which is not even utilized in the program.
>
> > #include <iostream>
> > using namespace std;
>
> > class Test
> > {
> > };
> The program has Undefined Behavior because 'main' has result type
> 'void', which is not permitted.
(This is a reply to the original post, but I dont' have a copy of
original post)
For an empty class, the members in the following list will be created
automatically or have predefined meanings. If the predefined versions
of these members are not what you expect, you may override the
corresponding members. These members are not inherited, for the child
classes will have their own versions automatically. There should be
some other members which will be provided automatically and are not
inherited. For example `->', ...
The following list comes from Bjarne Stroustrup's `The C++ Programming
Language, special edition'. Please correct me in case I don't
understand the programming language correctly,
a) Operators cannot be overloaded (sec 11.2, TC++PL sp ed):
:: (scope resolution)
. (member selection)
.* (member selection through pointer to member)

(ternary conditional expression operator)
sizeof
typeid
b) Operators have predefined meanings (sec 11.2.2, TC++PL sp ed):
operator= (assignment, same as in sec 11.7)
operator& (address-of)
operator, (sequencing)
c) Functions that control construction, destruction and copying (sec
11.7, TC++PL sp ed)::
class X
{
X(); // default constructor: create objects
X(const X&); // copy constructor
X& operator=(const X&); // copy assignment: cleanup and copy
~X(); // destructor: cleanup
};