How to construct a tree structure with smart pointer?

  • A+

Here is a code snippet which i want to get a tree structure with smart pointer.But i got c3646('parent': unknown override specifier) and c4430(missing type specifier - int assumed) in vs.Does anybody know what's going on and how do i fix it>?

#include<memory>  class Obj {     ObjPtr parent; }; typedef std::shared_ptr<Obj> ObjPtr; 


class Obj{     using ObjPtr = std::shared_ptr<Obj>;     ObjPtr parent; }; 

doesn't need so many declarations.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: