此类的对象大小是多少
What is the size of objects for this class?
Class Time{
int hour, min, sec;
Time(){};
Time(int h,int m, int s){
hour = h;
min = m;
sec = s;
}
void printTime(){
cout<<hr<<”:”<<min<<”:”<<sec;
}
}
我只想知道这个类中对象的大小是多少?
我会尝试这样的事情:
Time timeObject;
int size = sizeof(timeObject);
相关文章:
- 尝试并捕获C++ - 创建了多少对象
- 如果类没有任何成员变量,则通过临时对象调用类的成员函数的开销是多少?
- thread_local 和 std::future 对象 - 对象的生存期是多少
- 在没有返回值优化的情况下将两个对象加在一起时,将创建多少个临时对象
- 假设没有编译器优化,则将创建多少次此对象
- 每个对象内存分配有多少开销
- 范围内临时对象的生存期是多少?
- 传递给 std::runtime_error 的 ctor 的字符串对象的生命周期是多少?
- 在C 中存储对对象的引用需要多少内存
- 对象指针如何知道要删除多少内存
- 可以(通过编译器)使用多少个线程来初始化全局对象(函数main之前)
- 交换两个 std::array<T、100> 对象的成本是多少?
- 作为参数立即传递的对象生存期是多少
- 在C++中调用函数时构造了多少个对象
- 将创建多少个对象
- 当我从内联函数返回字符串时,会创建多少个临时对象
- C++函数,一个对象的默认值是多少
- 我如何才能知道以前在C++中从一个类创建了多少对象
- 初级C++:在不知道要创建多少对象的情况下在运行时创建对象
- 有多少对象(包含 std::vectors)加载到 L1/L2/L3 缓存中