232k views
1 vote
All members within a class are by default

User Don Boots
by
5.8k points

1 Answer

6 votes

Answer:

All the members within a class are by default are private. Private function in a class can access public function within a similar class. Private member formed the implementation of the class and also form the private interface of members within the class.

All the member of class can be access by function inside the class when it is declare as private.

For example:

class test

{ private:

int a; // when test:a is private

public:

test() : a() // a is accessible in test class

}

User RJ Adriaansen
by
5.7k points