GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 135 of 203    Print  
What are anonymous structure, unions and what are their uses?

  
Total Answers and Comments: 2 Last Update: September 22, 2007     Asked by: shyamsundar mohanta 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 02, 2007 23:12:16   #1  
Valentin        

RE: What are anonymous structure, unions and what are ...

Anonymous structures are not standard C++ therefore they are implemented as extensions.

Anonymous unions are standard C++ and they are can be found inside an object or inside a namespace.

1. When an anonymous union is declared inside of an object the role is to have all data members of that class or struct to share the same memory space and they are accessed as any other datamembers. This is not considered a healthy OO practice and it can be used only with the system that do not have a good support for typecasting. reinterpret_cast is the OO C++ recommended way over anonymous unions.

2. An anonymous union can be declared inside a namespace or at the global scope but because the unions members require internal linkage the union must be declared static.




 
Is this answer useful? Yes | No
September 22, 2007 06:08:21   #2  
bornToLose        

RE: What are anonymous structure, unions and what are ...
Mode mode + frequency[index] * (index+1)
 
Is this answer useful? Yes | No

 Related Questions

 Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. 
Latest Answer : You cannot use inline functions in a structure ...

Latest Answer : C does not have limitation access. Structures in C are used to regroup data from different types.In C++ structure have limitation access propreties (private,public protected) with public access as default, can contain methods and can be used as a class. ...
Read Answers (10) | Asked by : suji

Latest Answer : We can also use preprocessor #pregma pack(1) ...
Read Answers (3) | Asked by : Debasis Biswal

What is the difference between obeject oriented programing langauge and structure oriented programing langauge
Read Answers (2) | Asked by : ashish kedia

Latest Answer : we can resuse the code in object oriented language. we can handle errors properly.everything relates to real world objects. ...
Read Answers (2) | Asked by : vivek patil

Latest Answer : Mode = mode + frequency[index] * (index+1) ...
Read Answers (2) | Asked by : shyamsundar mohanta

Latest Answer : The Standard C++ language definition says: A class with an empty sequence of members and base class objects is an empty class. Complete objects and member sub-objects of an empty class type shall have nonzero size. Most compiler give a size of 1. ...
Read Answers (5) | Asked by : pushpakumar


 Sponsored Links

 
Related Articles

Microsoft AJAX Library - Anonymous Functions

Anonymous Functions Anonymous functions can be created adhoc and used instead of a named function Although this can hinder readability when the function is more complex you can do this if you don t intend to reuse a function s code In the following example we pass such an anonymous function to Displ
 

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++ Structure Part II

C Structure Part II In this C tutorial Structures Part II you will learn how to use structure in an efficient way and features of structures explained with examples mosgoogle center Structure Members Initialization As with arrays and variables structure members can also be initialized This is perfor
 

C++ Structure

C Structure In this C tutorial you will learn about Structure declaring a Structure how to declare Structure Variable and how to access the structure members in C mosgoogle What is a Structure Structure is a collection of variables under a single name Variables can be of any type int float char et
 

What is Common Data Structure

In big data warehouses such as those used by business organizations which may have many branches around the world and which may have diversified products and services, different kinds of data flood the warehouse every single day. These data may come from other warehouse data sources, or simply fresh
 

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’s al
 

ITIL Structure

In this article, let us go through some of the aspects involved in the ITIL Structure. Business Perspective The business perspective is meant to familiarize the Business Management with the supporting components and the architectural design of the Information and Technology (ICT), the infrastructure
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

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
 

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