Click here to Skip to main content
16,011,849 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalauto_ptr compile error Pin
George_George20-Mar-08 16:59
George_George20-Mar-08 16:59 
QuestionRe: auto_ptr compile error Pin
Rajkumar R20-Mar-08 22:55
Rajkumar R20-Mar-08 22:55 
GeneralRe: auto_ptr compile error Pin
George_George20-Mar-08 23:40
George_George20-Mar-08 23:40 
GeneralRe: auto_ptr compile error Pin
Rajkumar R21-Mar-08 0:14
Rajkumar R21-Mar-08 0:14 
GeneralRe: auto_ptr compile error Pin
George_George21-Mar-08 0:27
George_George21-Mar-08 0:27 
GeneralRe: auto_ptr compile error Pin
Rajkumar R21-Mar-08 0:31
Rajkumar R21-Mar-08 0:31 
GeneralRe: auto_ptr compile error Pin
George_George21-Mar-08 0:46
George_George21-Mar-08 0:46 
GeneralRe: auto_ptr compile error [modified] Pin
Rajkumar R21-Mar-08 1:19
Rajkumar R21-Mar-08 1:19 
I don't think this is the proof of concept code. AFAIK, this code has the full declaration of class Foo before it is referenced in func(), compared to the previous where you did class forward declaration "class Foo; only"

Try the following as in your previous post.


using namespace std;
class Foo; // forward declaration

void func()
{
  auto_ptr<Foo> pf (new Foo());	
  cout << "I am here. " << endl;
  return;
}
int main()
{
  func();	
  return 0;
}
// full declaration of class Foo
class Foo 
{
 public:
	Foo();
	~Foo();
};

Foo::Foo()
{}

Foo::~Foo()
{}


i did a quick search now this link may gives some idea on Class Forward Declaration When Full Declarations Are Not Required[^]

modified on Friday, March 21, 2008 8:50 AM

GeneralRe: auto_ptr compile error Pin
George_George21-Mar-08 20:58
George_George21-Mar-08 20:58 
Questionhow can i export a function of a class? Pin
alphaxz20-Mar-08 16:21
alphaxz20-Mar-08 16:21 
AnswerRe: how can i export a function of a class? Pin
David Crow20-Mar-08 16:39
David Crow20-Mar-08 16:39 
GeneralRe: how can i export a function of a class? Pin
Mark Salsbery20-Mar-08 16:53
Mark Salsbery20-Mar-08 16:53 
GeneralRe: how can i export a function of a class? Pin
alphaxz20-Mar-08 18:14
alphaxz20-Mar-08 18:14 
GeneralRe: how can i export a function of a class? Pin
Mark Salsbery20-Mar-08 21:04
Mark Salsbery20-Mar-08 21:04 
GeneralRe: how can i export a function of a class? Pin
CPallini20-Mar-08 21:51
mveCPallini20-Mar-08 21:51 
GeneralRe: how can i export a function of a class? Pin
Mark Salsbery21-Mar-08 5:52
Mark Salsbery21-Mar-08 5:52 
GeneralRe: how can i export a function of a class? Pin
CPallini21-Mar-08 7:12
mveCPallini21-Mar-08 7:12 
QuestionRe: how can i export a function of a class? Pin
David Crow21-Mar-08 3:15
David Crow21-Mar-08 3:15 
GeneralRe: how can i export a function of a class? Pin
Mark Salsbery21-Mar-08 5:51
Mark Salsbery21-Mar-08 5:51 
AnswerRe: how can i export a function of a class? Pin
Mark Salsbery20-Mar-08 16:49
Mark Salsbery20-Mar-08 16:49 
Generala managed array cannot have this element type Pin
Member 202102220-Mar-08 12:20
Member 202102220-Mar-08 12:20 
GeneralRe: a managed array cannot have this element type Pin
Mark Salsbery20-Mar-08 13:54
Mark Salsbery20-Mar-08 13:54 
GeneralRe: a managed array cannot have this element type Pin
Member 202102220-Mar-08 15:12
Member 202102220-Mar-08 15:12 
GeneralRe: a managed array cannot have this element type Pin
Mark Salsbery20-Mar-08 15:49
Mark Salsbery20-Mar-08 15:49 
GeneralRe: a managed array cannot have this element type Pin
Mark Salsbery20-Mar-08 16:00
Mark Salsbery20-Mar-08 16:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.