P
parag_paul
I saw an implementaiton with protected constrcutors.
What could be use of this construct be?
What could be use of this construct be?
I saw an implementaiton with protected constrcutors.
What could be use of this construct be?
I saw an implementaiton with protected constrcutors.
What could be use of this construct be?
I saw an implementaiton with protected constrcutors.
What could be use of this construct be?
Protected constructor is one possible way to implement the OOP concept
of "abstract base class" in C++. Protected constructor indicates that
the class is not supposed to be instantiated as a standalone object, but
only as a base class subobject of another class.
Noah said:There are numerous reasons why you would not want to allow direct
instantiation of a class or base.
Juha said:Can you give an example of such situation, where it cannot be done by
putting a pure virtual function in the base class?
Test said:"Andrey Tarasevich"
There are some loopholes to that method. Are there any experts that
have recommended this?
...
Can you give an example of such situation, where it cannot be
done by putting a pure virtual function in the base class?
What specific loopholes are you referring to?
Noah said:struct Base
{
private:
struct impl;
impl * pimpl;
protected:
Base();
public:
boost::shared_ptr<Base> construct_base();
Fraser said:...
As someones said a static member function could invoke a constructor.
Also a friend could. Possibly a nested class also.
The standard does not describe an ABC as you have.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.