Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

object inside class c++

It will be initialized by its default constructor. If you want to use a different constructor, you might have something like this:

class Foo
{
    public: 
    Foo(int val) { }
    //stuff
};

class Bar
{
    public:
    Bar() : foo(2) { }

    Foo foo;
};
 
PREVIOUS NEXT
Tagged: #object #class
ADD COMMENT
Topic
Name
1+2 =