small C++ things to remember

C++ like any other language has small stuff to remember.
since i dont have a good memory, i will keep here short C++ things to remember

Comments

  1. the size of an empty class or structure is not zero. it is one.

    http://tinf2.vub.ac.be/~dvermeir/c++/emptyopt.html

    ReplyDelete
  2. The base class from which each class is derived is declared before the declaration of the derived class. It is not sufficient to provide a forward-referencing declaration for a base class; it must be a complete declaration.

    for example:

    class A; // forward declaration


    // compile error; A must be defined
    class B : public A
    {

    };

    class A
    {
    };

    ReplyDelete

Post a Comment

Say something nice please.

Thank you.

Popular posts from this blog

Xamarin.Forms XmlnsDefinition attribute: All of your namespaces become one

Problems