What does this class declaration mean?

Zain Syed

Came across a snippet that I'm not sure how to interpret, in a header file:

...
private:
    class Ellipsoid * ellipse;

It's later initialized in the cpp:

ellipse = (Ellipsoid *) something->GetEllipse();

The class keyword on this data member is throwing me off. Is this a pointer to a class/type that inherits from Ellipsoid? Thus, is "ellipse" to be treated like a reference to a type?

Drew Dormann

The class keyword used there simply declares the symbol Ellipsoid to be a class at the site of its usage.

If the compiler already knows that symbol to be a class, it's optional.

class Ellipsoid;

class MyClass
{
    private:
        /*class*/ Ellipsoid * ellipse;
};

However, the usage you show will prevent compiler errors if the symbol is as-yet undeclared.

//class Ellipsoid;

class MyClass
{
    private:
        class Ellipsoid * ellipse;
};

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does this class declaration mean?

From Dev

What does this syntax mean in the declaration of an abstract class?

From Dev

What does [+A] mean in Scala class declaration?

From Dev

What does this c++ class declaration mean?

From Dev

What does <T?> mean in Class declaration?

From Dev

what does the Square brackets before a class declaration mean?

From Dev

What does this property declaration mean?

From Dev

Explanation for convoluted generic-type declaration. What does Class<? extends Class<? extends Actor>[]> actually mean?

From Dev

what does this javascript function declaration mean

From Dev

What does it mean to introduce a name into a declaration?

From Dev

What does ::type in c++ declaration mean?

From Dev

What does a star * alone mean in a function declaration?

From Dev

What does "duplicate data type in declaration" mean?

From Dev

What does __devexit mean in a function declaration?

From Dev

What does this declaration typedef void foo(); mean?

From Dev

What does this JS object declaration syntax mean?

From Dev

What does "duplicate data type in declaration" mean?

From Dev

What does this syntax mean relating to interface declaration?

From Dev

What does :: mean in class signature?

From Dev

What does it mean to destroy a class

From Dev

What does it mean by Lock on class?

From Dev

What does "unload class" mean?

From Dev

What does "Class<?" mean in Java?

From Dev

What does :: mean in class signature?

From Dev

What does Class.this mean?

From Dev

What does it mean for a class to be composed of another class?

From Dev

What does 'cdecl = nil' (placed after a function declaration) mean?

From Dev

What does it mean when const is put after a function's declaration?

From Dev

What does provider mean when used in method declaration?

Related Related

  1. 1

    What does this class declaration mean?

  2. 2

    What does this syntax mean in the declaration of an abstract class?

  3. 3

    What does [+A] mean in Scala class declaration?

  4. 4

    What does this c++ class declaration mean?

  5. 5

    What does <T?> mean in Class declaration?

  6. 6

    what does the Square brackets before a class declaration mean?

  7. 7

    What does this property declaration mean?

  8. 8

    Explanation for convoluted generic-type declaration. What does Class<? extends Class<? extends Actor>[]> actually mean?

  9. 9

    what does this javascript function declaration mean

  10. 10

    What does it mean to introduce a name into a declaration?

  11. 11

    What does ::type in c++ declaration mean?

  12. 12

    What does a star * alone mean in a function declaration?

  13. 13

    What does "duplicate data type in declaration" mean?

  14. 14

    What does __devexit mean in a function declaration?

  15. 15

    What does this declaration typedef void foo(); mean?

  16. 16

    What does this JS object declaration syntax mean?

  17. 17

    What does "duplicate data type in declaration" mean?

  18. 18

    What does this syntax mean relating to interface declaration?

  19. 19

    What does :: mean in class signature?

  20. 20

    What does it mean to destroy a class

  21. 21

    What does it mean by Lock on class?

  22. 22

    What does "unload class" mean?

  23. 23

    What does "Class<?" mean in Java?

  24. 24

    What does :: mean in class signature?

  25. 25

    What does Class.this mean?

  26. 26

    What does it mean for a class to be composed of another class?

  27. 27

    What does 'cdecl = nil' (placed after a function declaration) mean?

  28. 28

    What does it mean when const is put after a function's declaration?

  29. 29

    What does provider mean when used in method declaration?

HotTag

Archive