470,848 Members | 1,709 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

food for thoughts

Hi

1] can anyone tell me if i inherited a BASE class (with int and float
as data members)
then does that count into size of obj of derived class.
2] can i perform a operations like adding 2 obj and storing it's sum
into 3 rd one of type struct in c++. to my knowledge it's ans is NO.
but cn i use operator overloading to do this?

i havn't tried it, but if anyone has ans ,pls contact me.

bye,hav a GOOD DAY.

Feb 26 '06 #1
1 1332
On 26 Feb 2006 09:51:35 -0800, "amruta" <am******@gmail.com> wrote:
Hi

1] can anyone tell me if i inherited a BASE class (with int and float
as data members)
then does that count into size of obj of derived class.
Yes, of course.
2] can i perform a operations like adding 2 obj and storing it's sum
into 3 rd one of type struct in c++. to my knowledge it's ans is NO.
but cn i use operator overloading to do this?
It depends on how the objects are defined. But yes, you can definitely
overload operator+ for user-defined types. Obviously, the result of
adding two objects of a user-defined type should usually be the same
type, although one could overload the operator to return something
entirely different.
i havn't tried it, but if anyone has ans ,pls contact me.

bye,hav a GOOD DAY.


--
Bob Hairgrove
No**********@Home.com
Feb 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Laura Creighton | last post: by
354 posts views Thread by Montrose... | last post: by
4 posts views Thread by news.hku.hk | last post: by
reply views Thread by Kelly | last post: by
reply views Thread by raja | last post: by
reply views Thread by raja | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.