Sponsored Content
Top Forums Programming C++ type-casting a member variable in const methods Post 302462578 by Corona688 on Thursday 14th of October 2010 01:40:09 PM
Old 10-14-2010
It ought to work -- depending on what "member variable" was in the first place, of course. And the local variable of course will cease to exist when the function returns. It's also possible that being a "const" function has restricted its access to an operator it needs from the member variable, but in that case it should cause a compiler error... Can you post the actual code?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with variable type

Dear All, I am trying to write an script to calculate geometric centre of selected residues of a protein structure. Say I have a PDB file (a text containing the x, y, and z coordinates of atoms of a protein). I want to extract the X coordinates of the atoms belonging to the interested residues... (2 Replies)
Discussion started by: siavoush
2 Replies

2. Shell Programming and Scripting

how to get type of variable in perl

hello all how can i get the type of variable in perl like typeof(var); in javascript for instance ? to know if the variable is int or string ? (2 Replies)
Discussion started by: umen
2 Replies

3. Programming

Accesing structure member:Error:dereferencing pointer to incomplete type

$ gcc -Wall -Werror struct.c struct.c: In function `main': struct.c:18: error: dereferencing pointer to incomplete type $ cat struct.c #include <stdio.h> #include <stdlib.h> #include <string.h> /*Declaration of structure*/ struct human { char *first; char gender; int age; } man,... (3 Replies)
Discussion started by: amit4g
3 Replies

4. Shell Programming and Scripting

getting type of variable

Hello: Is there any way to tell the type of a passed or entered variable, if it is a string or integer,...etc. Thanks a lot (2 Replies)
Discussion started by: aladdin
2 Replies

5. Shell Programming and Scripting

Problem with type-casting in awk

Hi I'm trying to write a script which takes an integer as input and checks for files with size > input and displays it on screen. The code I've tried : echo 'Enter the min file size expected' read filesize du -ah <folder name> | awk -F: '$1>int(filesize) {print $1,$2)' is always... (28 Replies)
Discussion started by: vivek.bharadwaj
28 Replies

6. UNIX for Advanced & Expert Users

How type casting works ?

I am having a doubt with type casting in C. Very often in network programming, we have something like this: char *data = ...; struct iphdr *ip = (struct iphdr *) data; where iphdr is define in netinet/ip.h. Let us say that the size of the content of held by 'data' is much more than... (1 Reply)
Discussion started by: radiatejava
1 Replies

7. Programming

C++ program is crashing on re-assigning const static member variable using an int pointer

Hi, Can any one tell me why my following program is crashing? #include <iostream> using namespace std; class CA { public: const static int i; }; const int CA::i = 10; int main() { int* pi = const_cast<int*>(&CA::i); *pi = 9; cout << CA::i << endl; } (6 Replies)
Discussion started by: royalibrahim
6 Replies

8. Programming

Why this const variable is not changing even after applying const_cast?

Hi In the following code, why the variable 'i' still retains the value 10 instead of 11? Why it is not possible to alter this variable's value? int main() { const int i = 10; *(const_cast<int*>(&i)) = 11; cout << i << endl; // Ans: 10 } (6 Replies)
Discussion started by: royalibrahim
6 Replies

9. Shell Programming and Scripting

What is a type of this variable?

I have a question about the type of this variable checkU= sudo cat /etc/passwd: grep $uname: wc -l I write a script to check the existent of username that get from the keyboard. If there is no username,it will create the username else it show the 'Duplicate name" message. The problem is it... (4 Replies)
Discussion started by: thsecmaniac
4 Replies

10. Shell Programming and Scripting

Type casting problem

hi guys, i m new to shell script.. i dont know how to type cast string into integers and i mention my problem below.. date="21091988" month=$((${date:2:2})) # extract the month from previous date variable temp=$(($month*23)) when i am trying to calculate the temp value i got the... (5 Replies)
Discussion started by: raadhaakrishnan
5 Replies
SoGlobalSimplifyAction(3)					       Coin						 SoGlobalSimplifyAction(3)

NAME
SoGlobalSimplifyAction - The SoGlobalSimplifyAction class is for globally simplifying the geometry of a scene graph, globally. SYNOPSIS
Inherits SoSimplifyAction. Public Member Functions virtual SoType getTypeId (void) const SoGlobalSimplifyAction (void) virtual ~SoGlobalSimplifyAction (void) Static Public Member Functions static SoType getClassTypeId (void) static void addMethod (const SoType type, SoActionMethod method) static void enableElement (const SoType type, const int stackindex) static void initClass (void) Protected Member Functions virtual const SoEnabledElementsList & getEnabledElements (void) const " virtual void beginTraversal (SoNode *node) Static Protected Member Functions static SoEnabledElementsList * getClassEnabledElements (void) static SoActionMethodList * getClassActionMethods (void) Detailed Description The SoGlobalSimplifyAction class is for globally simplifying the geometry of a scene graph, globally. Constructor &; Destructor Documentation SoGlobalSimplifyAction::SoGlobalSimplifyAction (void) A constructor. SoGlobalSimplifyAction::~SoGlobalSimplifyAction (void) [virtual] The destructor. Member Function Documentation SoType SoGlobalSimplifyAction::getTypeId (void) const [virtual] Returns the type identification of an action derived from a class inheriting SoAction. This is used for run-time type checking and 'downward' casting. Usage example: void bar(SoAction * action) { if (action->getTypeId() == SoGLRenderAction::getClassTypeId()) { // safe downward cast, know the type SoGLRenderAction * glrender = (SoGLRenderAction *)action; } return; // ignore if not renderaction } For application programmers wanting to extend the library with new actions: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through Inventor/nodes/SoSubAction.h: SO_ACTION_SOURCE, SO_ACTION_INIT_CLASS and SO_ACTION_CONSTRUCTOR. For more information on writing Coin extensions, see the SoAction class documentation. Returns the actual type id of an object derived from a class inheriting SoAction. Needs to be overridden in all subclasses. Reimplemented from SoSimplifyAction. SoType SoGlobalSimplifyAction::getClassTypeId (void) [static] Returns the run-time type object associated with instances of this class. Reimplemented from SoSimplifyAction. void SoGlobalSimplifyAction::addMethod (const SoTypetype, SoActionMethodmethod) [static] This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Reimplemented from SoSimplifyAction. void SoGlobalSimplifyAction::enableElement (const SoTypetype, const intstackindex) [static] This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Reimplemented from SoSimplifyAction. const SoEnabledElementsList & SoGlobalSimplifyAction::getEnabledElements (void) const [protected], [virtual] Returns a list of the elements used by action instances of this class upon traversal operations. Reimplemented from SoSimplifyAction. SoEnabledElementsList * SoGlobalSimplifyAction::getClassEnabledElements (void) [static], [protected] This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. This method not available in the original OIV API, see SoSubAction.h for explanation. Reimplemented from SoSimplifyAction. SoActionMethodList * SoGlobalSimplifyAction::getClassActionMethods (void) [static], [protected] This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. This method not available in the original OIV API, see SoSubAction.h for explanation. Reimplemented from SoSimplifyAction. void SoGlobalSimplifyAction::initClass (void) [static] Initializes the run-time type system for this class, and sets up the enabled elements and action method list. Reimplemented from SoSimplifyAction. void SoGlobalSimplifyAction::beginTraversal (SoNode *node) [protected], [virtual] This virtual method is called from SoAction::apply(), and is the entry point for the actual scenegraph traversal. It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction. Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scenegraph traversal. Reimplemented from SoSimplifyAction. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 SoGlobalSimplifyAction(3)
All times are GMT -4. The time now is 07:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy