0

Why am i not able to get access to protected members of myclass when i am using auto_ptr ?

auto_ptr<myclass> aptr_myclass( new myclass );
aptr_peercfg->name=func(_name);
aptr_peercfg->lastname=func(_lastname);

class myclass{
protected:
  std::string                      name;
  std::string                      lastname;
}
Krcn U
  • 411
  • 1
  • 9
  • 16
  • 3
    [FYI] [`auto_ptr`](http://en.cppreference.com/w/cpp/memory/auto_ptr) is deprecated in the current standard and will be removed in the upcoming standard. You should consider using [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) or [`std::shared_ptr`](http://en.cppreference.com/w/cpp/memory/shared_ptr) – NathanOliver Jan 05 '16 at 14:00
  • I know but unfortunately i cant use other smart pointers due to the version constraints. – Krcn U Jan 05 '16 at 14:05

0 Answers0