Sponsored Content
Top Forums Programming Problem about c++ new operator Post 70121 by devesh on Tuesday 26th of April 2005 02:27:33 AM
Old 04-26-2005
This is working fine with me :

--------------------------------------
*****************************
#include <iostream>
using namespace std;

class test
{
private:
int i;
public:
inline test(int m)
{
i = m;
}
inline int get_i()
{
return i;
}
};

int main()
{
test * a = new test(2);
cout << a->get_i();
return 0;
}

*****************************
--------------------------------------

I compiled the code using g++ compiler on solaris.

Also there is no need to specify methods as inline, if you are defining the method inside class declaration. By default it becomes inline.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

And operator

I am trying to check two variables and if both are blank I want to set a flag: the_f3_pid=`rsh $target ps -ef | grep "f3.eab" | awk '{print $2}'` the_f7_pid=`rsh $target ps -ef | grep "f7.eab" | awk '{print $2}'` if ; then y=1 fi I get an error: ./script_name: test: 0403-021 ]... (4 Replies)
Discussion started by: rcarnesiii
4 Replies

2. Shell Programming and Scripting

Problem with here doc operator in FTP script

Hello folks, I am facing a problem with the following korn shell script snippet: ftp -n -i -v <<EOF print -p open $CURR_HOST print -p user $USER $PASSWD print -p binary print -p cd /mydir/subdir/datadir print -p get $FILENAME print -p bye EOF exit It gives me the following... (3 Replies)
Discussion started by: Rajat
3 Replies

3. UNIX for Dummies Questions & Answers

Problem unary operator expected

I get the following error ./get_NE05: line 42: while do echo ${STRING_NAME} J=1 if ; then EXT=0$I else EXT=$I fi while do echo $I-$J #calculating last occurrence OCCURRENCE=`grep -io "${STRING_NAME}"... (3 Replies)
Discussion started by: f_o_555
3 Replies

4. UNIX for Dummies Questions & Answers

problem with pipe operator

hi i am having issues with extra pipe. i have a data file and i need to remove the extra pipe in the(example 4th and 7thline) in datafile. there are many other line and filed like this which i need to remove from files. The sample data is below: 270 31|455004|24/03/2010|0001235|72 271... (3 Replies)
Discussion started by: abhi_n123
3 Replies

5. UNIX for Dummies Questions & Answers

+= operator

im new to bash scripting and im just using online tutorials and trial and error. i wanted to write a script to read numbers from a file and find their sum: #!/bin/bash theSum=0 for line in $(cat numbers.txt) do let "theSum = theSum + $line" echo "$line" done echo "The sum is... (3 Replies)
Discussion started by: astrolux444
3 Replies

6. UNIX for Dummies Questions & Answers

"binary operator exected" problem

Hey guys/gals, Am having trouble getting an 'if statement' to play nice.. I am playing with a script and need 'if' to check whether "y" or "Y" has been entered and if not to exit. In previous scripts I was playing with there would normally be a Y and a N response possibility so each... (2 Replies)
Discussion started by: TAPE
2 Replies

7. UNIX for Dummies Questions & Answers

Magic numbers '&' operator problem

Hello everyone, on the man page of "magic(5)" There is explanation "&, to specify that the value from the file must have set all of the bits that are set in the specified value" . My question is that what is the difference between '&' and equal operator '=' ? I tested it with file... (6 Replies)
Discussion started by: segmentation
6 Replies

8. Shell Programming and Scripting

Problem in test file operator on a ufsdump archive file mount nfs

Hi, I would like to ask if someone know how to test a files if exist the file is a nfs mount ufsdump archive file.. i used the test operator -f -a h almost all test operator but i failed file1=ufs_root_image.dump || echo "files doesn't exist && exit 1 the false file1 is working but... (0 Replies)
Discussion started by: jao_madn
0 Replies

9. Programming

Problem with STL's std::set container parameter to the operator << ()

Hi, I have this following code which gives me error when compiling. The problem is happening at the point where I create a const_iterator inside the overloaded insertion operator (i.e) operator << () function. The template argument version of set is not correct I guess. Could anyone please pitch... (3 Replies)
Discussion started by: royalibrahim
3 Replies

10. Shell Programming and Scripting

awk Help - Comparison Operator problem

Hi, I've tried searching through the forum but I've drawn a blank so i'm going to post here. I'm developing a number of checks on a CSV file, trying to find if any are greater than a max limit. I'm testing it by running it from a command line. The file I'm testing has 8 records. When I... (3 Replies)
Discussion started by: Tmart
3 Replies
SbMutex(3)							       Coin								SbMutex(3)

NAME
SbMutex - A basic class for managing a mutex. This class provides a portable framework around the mutex interface of the underlying native thread-handling toolkit. SYNOPSIS
#include <Inventor/threads/SbMutex.h> Public Member Functions SbMutex (void) ~SbMutex () int lock (void) SbBool tryLock (void) int unlock (void) Detailed Description A basic class for managing a mutex. This class provides a portable framework around the mutex interface of the underlying native thread-handling toolkit. Constructor &; Destructor Documentation SbMutex::SbMutex (void) [inline] Constructor. SbMutex::~SbMutex () [inline] Destructor. Member Function Documentation int SbMutex::lock (void) [inline] This method locks the mutex. 0 is returned on success. If the mutex was previously unlocked, the thread will lock the mutex and continue running. If the mutex was already locked when this call is made, the thread will be suspended until the other thread holding the mutex releases it. This is a blocking operation. SbBool SbMutex::tryLock (void) [inline] This method tries to lock the mutex, and returns whether it was locked or not. This is a non-blocking operation. int SbMutex::unlock (void) [inline] This method unlocks the mutex. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 SbMutex(3)
All times are GMT -4. The time now is 06:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy