摘要:
使用智能指针释放在堆上分配的内存(超出作用域就释放) class Entity { private: float x, y; public: Entity(float x,float y):x(x),y(y) { std::cout<<"Created Entity!"<<std::endl; } 阅读全文
posted @ 2023-08-25 16:47
iu本u
阅读(15)
评论(0)
推荐(0)
摘要:
再数据结构内重载它的操作符,一般会先写一个函数,然后再重载符号:返回类型+operator+重载符号(参数){//定义} Vector2 Multity(const Vector2& other)const { return Vector2(x * other.x, y * other.y); } 阅读全文
posted @ 2023-08-25 16:11
iu本u
阅读(18)
评论(0)
推荐(0)
摘要:
递归 TreeNode* dfs(TreeNode* root,TreeNode* p,TreeNode* q){ if(!root)return root;//当发现这个节点已经是叶节点时,要告诉上层 if(root==p||root==q)return root;//当发现是p节点或者q时也要告 阅读全文
posted @ 2023-08-25 14:48
iu本u
阅读(25)
评论(0)
推荐(0)

浙公网安备 33010602011771号