food for thoughts

A

amruta

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.
 
B

Bob Hairgrove

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top