Click here to Skip to main content
15,922,407 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTemplate Overloading of Non-Mrember Operator [modified] Pin
JKallen8-Sep-06 20:09
JKallen8-Sep-06 20:09 
I am trying to overload an assignment operator that that assigns an underlying type with the the assignment operator of the template's underlying class. It should be much simpler than creating the syntax of my opening sentence.

If anyone can tell me what the hell im doing wrong I would be much obliged.


template <typename T> T& operator=(T& t,const Object<T>& object);

template <typename T> class Object{
friend T& operator=(T& t,const Object<T>& object);
public:
Object();

//ommitted for brevity

protected:
Object<T>* m_daddy;
T m_data;
};

//----------------------------------FOLLOWING IS THE CPP FILE


#include "StdAfx.h"
#include ".\table.h"

template <typename T> T& operator=(T& t,const Object<T>& object){
t = object.m_data;
return t;
}

template <typename T> Object<T>::Object(){
//the constructor stuff goes here
}

I GET THE FOLLOWING ERROR

c:\Visual Studio Projects\Statistician Pro\Table.h(5): error C2801: 'operator =' must be a non-static member

AnswerRe: Template Overloading of Non-Mrember Operator Pin
Michael Dunn9-Sep-06 17:34
sitebuilderMichael Dunn9-Sep-06 17:34 
QuestionTree View / List View combination Pin
Richard Andrew x648-Sep-06 19:40
professionalRichard Andrew x648-Sep-06 19:40 
AnswerRe: Tree View / List View combination Pin
Waldermort8-Sep-06 20:20
Waldermort8-Sep-06 20:20 
GeneralRe: Tree View / List View combination Pin
Richard Andrew x649-Sep-06 6:00
professionalRichard Andrew x649-Sep-06 6:00 
AnswerRe: Tree View / List View combination Pin
Michael Dunn9-Sep-06 17:48
sitebuilderMichael Dunn9-Sep-06 17:48 
GeneralRe: Tree View / List View combination Pin
Richard Andrew x649-Sep-06 17:52
professionalRichard Andrew x649-Sep-06 17:52 
QuestionIs there another ways to get file date stamp? Pin
pcname8-Sep-06 14:53
pcname8-Sep-06 14:53 
AnswerRe: Is there another ways to get file date stamp? Pin
Richard Andrew x648-Sep-06 19:51
professionalRichard Andrew x648-Sep-06 19:51 
GeneralRe: Is there another ways to get file date stamp? Pin
pcname9-Sep-06 3:17
pcname9-Sep-06 3:17 
GeneralRe: Is there another ways to get file date stamp? Pin
Gary R. Wheeler9-Sep-06 5:25
Gary R. Wheeler9-Sep-06 5:25 
QuestionInstall runtime libraries??? Pin
CTaylor898-Sep-06 8:50
CTaylor898-Sep-06 8:50 
AnswerRe: Install runtime libraries??? Pin
Jun Du8-Sep-06 9:18
Jun Du8-Sep-06 9:18 
GeneralRe: Install runtime libraries??? Pin
CTaylor898-Sep-06 10:14
CTaylor898-Sep-06 10:14 
GeneralRe: Install runtime libraries??? Pin
CTaylor898-Sep-06 11:06
CTaylor898-Sep-06 11:06 
GeneralRe: Install runtime libraries??? Pin
Dave Calkins8-Sep-06 13:03
Dave Calkins8-Sep-06 13:03 
QuestionLink issue with VS 2005 Pin
ky_rerun8-Sep-06 8:31
ky_rerun8-Sep-06 8:31 
AnswerRe: Link issue with VS 2005 Pin
ky_rerun8-Sep-06 8:35
ky_rerun8-Sep-06 8:35 
Questionpointers and array of pointers question Pin
kitty58-Sep-06 8:01
kitty58-Sep-06 8:01 
AnswerRe: pointers and array of pointers question Pin
David Crow8-Sep-06 8:04
David Crow8-Sep-06 8:04 
GeneralRe: pointers and array of pointers question Pin
kitty58-Sep-06 8:06
kitty58-Sep-06 8:06 
AnswerRe: pointers and array of pointers question Pin
Cedric Moonen8-Sep-06 8:18
Cedric Moonen8-Sep-06 8:18 
AnswerRe: pointers and array of pointers question Pin
Chris Losinger8-Sep-06 8:27
professionalChris Losinger8-Sep-06 8:27 
AnswerRe: pointers and array of pointers question Pin
David Crow8-Sep-06 8:28
David Crow8-Sep-06 8:28 
GeneralRe: pointers and array of pointers question Pin
kitty58-Sep-06 10:20
kitty58-Sep-06 10:20 

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.