Sponsored Content
Top Forums Programming what is diff b/w copy constructor and overloaded assignment operator Post 302130364 by amitpansuria on Monday 6th of August 2007 01:02:27 AM
Old 08-06-2007
what is diff b/w copy constructor and overloaded assignment operator

Helo i m new in c++.
i m confuse about what is exact difference b/w copy constructor and overloaded assignment operator.
Regards,
Amit
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

copy diff files

I have to synchronize files on two machines, but these are not connected via LAN. Now I'm using DVD's to copy new data. The question is how can I create a list of files on one machine and having this list archive or copy only new files from other. Are there any standard tools like diff/patch for... (3 Replies)
Discussion started by: Hitori
3 Replies

2. Shell Programming and Scripting

scalar variable assignment in perl + { operator

When reading over some perl code in a software document, I came across an assignment statement like this $PATH = ${PROJECT}/......./.... In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this... (3 Replies)
Discussion started by: JamesGoh
3 Replies

3. Shell Programming and Scripting

Copy data and send it to other file, with diff config

I need a new script to 'grep' data from files in var and send it to another file in var folder with diff output, but like you now my Now How is very, very small then to have a idea is something like this: in file text1.txt have a few lines like this one: Y: { XXX1 { XXX2 YYYY { IIIIIIII... (0 Replies)
Discussion started by: single
0 Replies

4. Programming

Doubt regarding Copy Constructor and return value

Hi All, I have made the simple following program :- #include <string> #include <iostream> using namespace std; class A{ private: int val; public : A(){cout<<"In A()"<<endl;} A (const A& aa) { cout<<"In copy c'tor"<<endl; } }; A f(... (1 Reply)
Discussion started by: shubhranshu
1 Replies

5. Programming

c++ assignment operator overloading

Hello everyone! Suppose that I have something like this A a; a.mem=new int; A b = a; where class A { public: int * mem; A() : mem(NULL) { } ~A() { if (mem!=NULL) delete mem; (1 Reply)
Discussion started by: bashuser2
1 Replies

6. Programming

Doubts on C++ copy constructor concept

Hi, If I run the following program class A { public: A() { cout << "default" << endl; } A(const A&) { cout << "copy" << endl; } }; A tmp; A fun() { return tmp; } A test() { A tmp; cout << &tmp << endl; return tmp; } (1 Reply)
Discussion started by: royalibrahim
1 Replies

7. Shell Programming and Scripting

diff script to copy files to other dir when not exists

I have two directories that are mostly the same: dir1 dir2 Is there an easy way to take the output of diff and copy files from dir1 that do not exist in dir2 - but copy them to the same path (many nested directories). am only trying to copy files in dir1 that do not exist in dir2. ... (5 Replies)
Discussion started by: jvsrvcs
5 Replies

8. Programming

Need to understand the overloaded assignment operator behavior

Hi, In the following code, class A { public: void operator=(const A& rhs) { if (this == &rhs) cout << "self-assigned"; } }; class B { A a; // should not be a pointer member, (i.e) A* a }; int main() { B b; b = b; // Ans: self-assigned } I am really... (5 Replies)
Discussion started by: royalibrahim
5 Replies

9. Shell Programming and Scripting

Assignment operator without operand

Does anyone know how this line in bash works? local gotbase= force= nicelevel corelimit local pid base= user= nice= bg= pid_file= local cgroup= These lines are part of the daemon function inside the "functions" file at /etc/init.d in RH. (3 Replies)
Discussion started by: Rameshck
3 Replies

10. Shell Programming and Scripting

Bash variable assignment failure/unary operator expected

I have a little code block (executing on AIX 7.1) that I cannot understand why the NOTFREE=0 does not appear to be assigned even though it goes through that block. This causes a unary operator issue. #!/bin/bash PLATFORM="AIX" NEEDSPC=3000 set -x if ; then lsvg | grep -v rootvg | while... (6 Replies)
Discussion started by: port43
6 Replies
FBB::IFdStreambuf(3bobcat)				File Descriptor Input Stream Buffer				FBB::IFdStreambuf(3bobcat)

NAME
FBB::IFdStreambuf - Input stream buffer initialized by a file descriptor SYNOPSIS
#include <bobcat/ifdstreambuf> Linking option: -lbobcat DESCRIPTION
FBB::IFdStreambuf objects may be used as a std::streambuf of std::istream objects to allow extractions from a file descriptor. File descriptors are not defined within the context of C++, but they can be used on operating systems that support the concept. Realize that using file descriptors introduces operating system dependencies. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
std::streambuf ENUMERATION
The public enumeration Mode defined in the class FBB::IFdStreamBuf has the following values: o CLOSE_FD, indicating that the file descriptor used by the object must be closed; o KEEP_FD (the default) indicating that the file descriptor used by the object must not be closed. CONSTRUCTORS
o Ifdstreambuf(): This constructor initializes the streambuf, without associating it to a file descriptor, and without using buffering. The member open() can be used subsequently to associate the object with a file descriptor and optionally a buffer size. When the object is destroyed or if the mode-less overloaded version of the open member is called, the file descriptor will not be closed. o Ifdstreambuf(Mode mode): This constructor initializes the streambuf, without associating it to a file descriptor, and without using buffering. The member open() can be used subsequently to associate the object with a file descriptor and optionally a buffer size. When the object is destroyed or if the mode-less overloaded version of the open member is called, the Mode argument determines whether the file descriptor will be closed or will remain open. o IFdStreambuf(int fd, size_t n = 1): This constructor initializes the streambuf, associating it to file descriptor fd, and an optional unget buffer size (by default hav- ing size 1). When the object is destroyed or if the mode-less overloaded version of the open member is called, the file descriptor will not be closed. o IFdStreambuf(int fd, Mode mode, size_t n = 1): This constructor initializes the streambuf, associating it to file descriptor fd, and an optional unget buffer size (by default hav- ing size 1). When the object is destroyed or if the mode-less overloaded version of the open member is called, the Mode argument determines whether the file descriptor will be closed or will remain open. There is no copy constructor. MEMBER FUNCTIONS
All members of std::streambuf are available, as FBB::IFdStreambuf inherits from this class. Some of the std::streambuf's member are over- ridden by FBB::IFdStreambuf, see below. o void close(): The file descriptor used by the IFdStreambuf is closed, irrespective of the Mode that was specified when the IFdStreambuf object was constructed. Following close the IFdStreambuf object can no longer be used until one of its open members has been called. o int fd() const: The file descriptor used by the IFdStreambuf object is returned. If the OFdStreambuf is not associated with a file descriptor -1 is returned. o void open(int xfd, size_t n = 1): The streambuf is (re)initialized, using file descriptor fd, and an optional unget buffer size (by default having size 1). When called repeatedly, the Mode specification used whem the object was constructed determines whether the file descriptor will be closed or will remain open. o void open(int xfd, Mode mode, size_t n = 1): The streambuf is (re)initialized, using file descriptor fd, a file descriptor closing parameter and an optional unget buffer size (by default having size 1). Depending on the Mode argument the object's currently used file descriptor will be closed or will remain open when the IFdStreambuf object is destroyed. Note that there is no overloaded assignment operator available for this class. EXAMPLE
To do FILES
bobcat/ifdstreambuf - defines the class interface SEE ALSO
bobcat(7), ifdstream(3bobcat), ofdstreambuf(3bobcat), std::streambuf BUGS
The member xsgetn(char *dest, std::streamsize n) will set istream::good() to false when fewer bytes than n were read using istream::read(). Also see xsgetn's description. Note that by default the provided file descriptors remain open. The complementary class ofdstreambuf(3bobcat) closes the file descriptor by default. This inconsistency was deliberately accepted to keep the classes interfaces backward compatible. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::IFdStreambuf(3bobcat)
All times are GMT -4. The time now is 03:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy