GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  C++
Go To First  |  Previous Question  |  
 C++  |  Question 47 of 47    Print  
Empty Class Size
What is the size of an empty class?


  
Total Answers and Comments: 2 Last Update: October 29, 2009     Asked by: MURALIR 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 21, 2009 01:18:50   #1  
VENKATGOPU Member Since: May 2009   Contribution: 9    

RE: Empty Class Size
Empty class size is 1.

Example:

#include<iostream>
using namespace std;
class A
{
};
int main()
{
cout<<sizeof(A)<<endl;
system("pause");
return 0;
}

Thanks & Regards
Venkat Gopu

 
Is this answer useful? Yes | No
October 29, 2009 09:11:33   #2  
cpfeed Member Since: October 2009   Contribution: 1    

RE: Empty Class Size
class A{
}

most of time sizeof(A) 1 however it is a small integer regarding to the complier.

 
Is this answer useful? Yes | No

 Related Questions

Anybody knows how to convert object of one class to object of another class using type conversion? i read in a c++ book simply assign it like this obj1=obj2 where both are objects of different classes..but its not working..plz tell ..thanks in advance :)
Read Answers (3) | Asked by : vishal

Latest Answer : Both the above methods doesn't meet the purpose. Try thisclass singleton{ private: /*add what ever data members necessary*/ static singleton* obj; singleton() ...
Read Answers (3) | Asked by : santosh

Latest Answer : "Class" is a logical abstraction, whereas its "instance" has a physical existence (Which is basically called an Object of that class). ...
Read Answers (1) | Asked by : lucifer

What is the size of an empty class? 
Latest Answer : class A{}most of time sizeof(A) = 1, however, it is a small integer regarding to the complier. ...
Read Answers (2) | Asked by : MURALIR


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

How to Access C++ Class Members

How to Access C Class Members In this C tutorial you will learn how to access Class members dot operator or class member access operator difference between struct and class and&nbsp; scope resolution operator mosgoogle center It is possible to access the class members after a class is defined an
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school&rsquo;s al
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.&nbsp; By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.&nbsp; IT Certification offers several vari
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 

UML Elements : Class Diagram

UML Elements UML 2 0 is comprised of a total of 13 diagrams If you wish to understand these diagrams they should be organized based on a hierarchy For UML a diagram is an element which must define which things should be modeled in a system mosgoogle center Introduction to Class Diagram In this arti
 

The Difficult Past of Neuro-linguistic programming

The Difficult Past of Neuro linguistic programming Neuro linguistic programming has had a rocky past with a number of lawsuits rivalry unsystematic development and intermittent progress During the 1980s the two founders separated after the lawsuit filed by Bandler Bandler went on to file several law
 

History of Neuro Linguistic Programming (NLP)

History of Neuro linguistic programming Neuro Linguistic Programming NLP is a system co founded by John Grinder and Richard Bandler for bringing about personal development in any individual by interpreting and translating the human perception experience beliefs and language It was developed in early
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape