473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

reference variable...and normal.....variable.....

can any budy help me out.......

plz.....tell me the diffrence b/w reference variable...and
normal.....variable.....
in context of prons and cons....
for example

class base
{
int a,b,c,d;
...........
...........
...........
...........
};
void main()
{
base obj,&ref=*(new base);
cout<<sizeof(obj);// outout 8
cout<<sizeof(ref);// output 8
}
if size of both the variable is same......and even accessing method is
same.......then...is there any benifit......to use refrence
variable.....instead of normal.......if...any plz xplain

kkaushik

Apr 25 '06 #1
2 1742
dost wrote:
can any budy help me out.......

plz.....tell me the diffrence b/w reference variable...and
normal.....variable.....
in context of prons and cons....
for example

class base
{
int a,b,c,d;
...........
...........
...........
...........
};
void main()
{
base obj,&ref=*(new base);
cout<<sizeof(obj);// outout 8
cout<<sizeof(ref);// output 8
}
if size of both the variable is same......and even accessing method is
same.......then...is there any benifit......to use refrence
variable.....instead of normal.......if...any plz xplain

kkaushik


See the FAQ:

http://www.parashift.com/c++-faq-lite/references.html

Cheers! --M

Apr 25 '06 #2
mlimber wrote:
dost wrote:
can any budy help me out.......

plz.....tell me the diffrence b/w reference variable...and
normal.....variable.....
in context of prons and cons....
for example

class base
{
int a,b,c,d;
...........
...........
...........
...........
};
void main()
{
base obj,&ref=*(new base);
cout<<sizeof(obj);// outout 8
cout<<sizeof(ref);// output 8
}
if size of both the variable is same......and even accessing method is
same.......then...is there any benifit......to use refrence
variable.....instead of normal.......if...any plz xplain

kkaushik


See the FAQ:

http://www.parashift.com/c++-faq-lite/references.html

Cheers! --M


Is there a section in the FAQ on the prons [sic] and cons of minimally
coherent English?
Apr 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sreenivas | last post by:
Hi, We cannot return a reference to an automatic variable from a function, as per the ANSI C++ standard the behaviour is undefined. Does this hold for inline functions too? or can I return a...
7
by: Howard | last post by:
Hi, in one of the recent posts, I saw someone pass two variables of built-in type (int and double), by reference, to a member function of a class. That function then took the addresses of those...
7
by: Pekus Cons. e Desenvolvimento | last post by:
Hi, I have seen some developers commenting that a reference variable is 'more garbage collection eligible' if the programmer set its value to null after using it, like this: public void...
13
by: Maxim | last post by:
Hi! A have a string variable (which is a reference type). Now I define my Method like that: void MakeFullName(string sNamePrivate) { sNamePrivate+="Gates" }
3
by: markaelkins | last post by:
Hi. I am trying to enter a variable in the treenodesrc of a treenode. I am basically trying to send an ID variable into sql to return different records. I've searched everywhere and cannot find the...
6
by: Rob Nicholson | last post by:
How do you handle references to a variable in VB.NET? Consider something like this: Public Class MyClass Private m_Widget As MyWidget End Class I realise that if you do something like:
51
by: Kuku | last post by:
What is the difference between a reference and a pointer?
22
by: tshad | last post by:
If I am passing a variable by reference to another routine by reference, do I need to dereference first? string testString; .... FirstSub(ref firstString) { HandleString(ref firstString); ...
27
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.