LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-19-2005, 04:41 PM   #1
byteframe
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 62

Rep: Reputation: 15
overloading an assignment operator to change one class to one that derives it


I have a base class called TextBuffer, and I have two other classes that extend it, via inhertiance and all that jazz.

In my client program I have a vector container that stores TextBuffer objects.

I plan to research assignment operator overloading to add the functionality for converting a TextBuffer object to a Rotation object.

I would imagine I can do this easily enough. But Do I even have to? Would it be inherent that the default operator for assignemtn in derived classes already knows what to do?

Regardless, a bigger question is will my TextBuffer vector container (vector<TextBuffer> theBuffers be able to hold objects, that while may be differant from each other, still are, or are at least derived from a base class?

Please Assist Thank you.
 
Old 12-19-2005, 04:52 PM   #2
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Regardless, a bigger question is will my TextBuffer vector container (vector<TextBuffer> theBuffers be able to hold objects, that while may be differant from each other, still are, or are at least derived from a base class?
A class can be referred to as its base class, this is how polymorphism works.
As for your other question, i don't understand what you are asking;(

Last edited by dmail; 12-19-2005 at 04:54 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with overloading operator+ in C++ niteshadw Programming 13 07-20-2005 07:45 PM
Operator Overloading problem ashwinipahuja Programming 1 06-23-2004 05:59 AM
c++ [] operator overloading exodist Programming 12 04-17-2004 03:06 PM
c++ overloading input operator true_atlantis Programming 4 02-25-2004 07:24 PM
C++ overloading extraction operator petercool Programming 5 09-06-2003 06:35 AM


All times are GMT -5. The time now is 02:42 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration