1 Star 0 Fork 1

llongger/Code_C++

forked from GodOuO/Code_C++ 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
003.Class.cpp 544 Bytes
一键复制 编辑 原始数据 按行查看 历史
GodOuO 提交于 2023-03-15 04:05 . Train
#include<iostream>
#include<string>
using namespace std;
class Person
{
private:
int m_A;
static int m_B;
public:
void func();
static void func2();
Person(/* args */);
~Person();
};
int Person::m_B = 0;
Person::Person(/* args */)
{
}
Person::~Person()
{
}
void test01(){
Person p;
cout<<"Size of P = "<<sizeof(p)<<endl; //空对象占用内存
}
void test02(){
Person p;
cout<<"Size of P = "<<sizeof(p)<<endl; //非静态有成员变量对象占用内存
}
int main(){
//test01();
test02();
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/llongger/codeCpp.git
git@gitee.com:llongger/codeCpp.git
llongger
codeCpp
Code_C++
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385