Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 11th, 2007, 7:53 AM   #21
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 3 rwm is on a distinguished road
hey, so it appears that i have to declare all the code inline for it to work???

i.e.

class Object {
	public:
		//constructors
		Object() : this_object(0) {}
		template<typename ObjectType>
		Object(const ObjectType &value) : this_object(new holder<ObjectType>(value)) {}
		...
};

works

but if i do this:

//Object.h
class Object {
	public:
		//constructors
		Object();
		template<typename ObjectType> Object(const ObjectType &);
		...
};

//Object.cpp
		...
//overloaded constructor
template<typename ObjectType>
Object::Object(const ObjectType &value) : this_object(new holder<ObjectType>(value)) {}
		...

it stuffs up????

why?
rwm is offline   Reply With Quote
Old May 11th, 2007, 8:11 AM   #22
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 3 rwm is on a distinguished road
ah, also there seems to be a problem here:

int main() {
	//
	float flt(3.34343);
	Object myobj(flt);

	cout << myobj.GetType().name() << endl;

	return 0;
}

the output is:


it should be "float" ???? wtf?
rwm is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Level Editor frankish Show Off Your Open Source Projects 47 Jul 10th, 2006 7:57 PM
The Black Art of Video Game Console Design lostcauz Book Reviews 0 Apr 26th, 2006 8:31 PM
Attitudes Oddball Coder's Corner Lounge 29 Mar 18th, 2006 10:34 PM
object oriented game design furqanchandio Other Programming Languages 5 May 11th, 2005 10:17 AM
Moving Object ... Question . ASHORY Visual Basic 1 Mar 14th, 2005 3:17 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC