pointers and references

October 21, 2010 at 18:52:52
Specs: Windows XP
i have this program..

#include "stdafx.h"
#include<iostream>
#include "A"
#include "B"
using namespace std;
func(A & obj, B*bptr)
{

obj.anum=5;
ptr->bnum=10;


}
int _tmain(int argc, _TCHAR* argv[])
{
A a;
A & ra=a;
B b;
func(ra,&b);

int weight = 96;
int *pWeight = &weight;
int &rWeight = weight;

int another = 123;
int athird = 770;

cout << "weight " << weight << endl;
cout << "pWeight " << pWeight << endl;
cout << "*pWeight " << *pWeight << endl;
cout << "rWeight " << rWeight << endl << endl;

// Note - following line does NOT reassign rWeight; it
// assigns a new value to the variable that rWeight references

rWeight = another;

cout << "weight " << weight << endl;
cout << "pWeight " << pWeight << endl;
cout << "*pWeight " << *pWeight << endl;
cout << "rWeight " << rWeight << endl << endl;

// Following line changes pWeight only; it's NOT an alias
// so it leaves weight and rWeight alone

pWeight = &athird;

cout << "weight " << weight << endl;
cout << "pWeight " << pWeight << endl;
cout << "*pWeight " << *pWeight << endl;
cout << "rWeight " << rWeight << endl << endl;


return 0;
}

where heasder files are

class A
{
public:
int anum;
}

class B
{
public:
int bnum;
}

Error is :

'A': No such file or directory its nto running .. i use this header file by .h extension but not working .. kindly help me in this regard


See More: pointers and references

Report •


#1
October 22, 2010 at 05:56:11
Is the header file named A or A.h?

How To Ask Questions The Smart Way


Report •

#2
October 22, 2010 at 22:12:43
ofcource header file si A.h

Report •

#3
October 23, 2010 at 03:42:09
piyapiya: ofcource header file si A.h
That's not what you're telling the complier.
piyapiya: #include "A"

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question