152k views
0 votes
Using C++, Write a full class definition for a class named Acc1, containing no constructors, functions, or data members (i.e., a totally empty class). (Note, the last character of the classname is "one" not "ell".)

User Charles DB
by
8.0k points

1 Answer

6 votes
Hi!

Okay, so -

To make a C++ class, we have to use the keyword class followed by the class name, and a pair of curly braces which will be our class body.

Our class body is what holds all of our constructors, functions, and data members.

So, to write a completely empty class - we would just have to simply write:

class Acc1
{

};

Note -

All classes must end with a semi colon! This is just a standard rule we follow since it was how C++ has been defined. If you were to leave the semi colon out, you would get a compiler error! =)
User Anssias
by
7.8k points