Click here to Skip to main content
16,016,024 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi,

What is the use of Object slicing. which situation we use it.

it is a interview question
Posted
Updated 23-Jul-15 7:20am
v2

As far as I know we use object slicing, well, when we make a mistake, see, for instance: "What is object slicing?"[^] at Stack Overflow.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 23-Jul-15 13:34pm    
To me, inventing a special term for that is pretty silly, and the questions itself probably can be called idiotic. There is really no need in knowing this kind of "terms". The problems as trivial as that one are endless in OOD/OOP, any requirements to know than all only because someone coined some "terms" would be quite counter-productive. Please see Solution 1.
—SA
CPallini 23-Jul-15 14:54pm    
Got stack overflow while following your suggestion... :-D
Albert Holguin 23-Jul-15 20:00pm    
Sounds like a useless property...lol, +5
First of all, it's quite useless to prepare interview answers. Please see my past answer: SSRS interview questions and answers[^].

But I would understand that it's just your curiosity. It would be a great thing if you paid any reasonable effort to learn what it is. It would be so simple:
https://en.wikipedia.org/wiki/Object_slicing[^].

But if you did not answer this question on the interview, you should not be too frustrated. I would say, this question is quite bad, maybe it even could be called an idiotic question. It does not reveal any understanding, knowledge of theory, nothing. It's just about knowing one quite rarely used and not particularly useful term, something which no one should be required to know, unless this is a part of some specific internal corporate culture (which you also would not supposed to know). I mean, many people who understand OOP to the finest detail may also be unaware of this limited-use form. The meaning of the term is just nothing special, something pretty trivial and hence hard to remember, which does not really needs a special term. People experience in OOD face enormous number of aspects of the same level which never got a special term for that, and don't suffer too much. :-)

So, practically, during the interviews, you can try to block the attempts to get you in awkward position by telling something like "if you tell me what do you mean by this term, it's likely that I understand well how to work with such things, because I'm quite competent in OOP and OOD". Of course, you should really be confident in the matters.

—SA
 
Share this answer
 
Comments
CPallini 23-Jul-15 14:53pm    
Don't know why it was downvoted, have my 5.
Maybe it is just a test to see if the candidate did read the Stroustrup book, He Himself uses such a term. :-)
Sergey Alexandrovich Kryukov 23-Jul-15 14:59pm    
Thank you, Carlo. I would not care too much about who uses what term exactly, really. It does not make the question reasonable. Ridiculous requirements at the interviews are as common as their ability to easily hire someone who have no a clue how to do software. As to the particular use of a very specific terms, it tells the tail. It could be a sign the the interviewer read some Stroustrup book and almost nothing else. :-)
—SA
Albert Holguin 23-Jul-15 20:00pm    
+5... I hate all these special terms as well
Sergey Alexandrovich Kryukov 23-Jul-15 21:54pm    
Thank you, Albert.
I would say... there is absolutely no reason to hate the "terms" themselves, but the ignorant "specialists" making a parade with them should be opposed.

I call it "bird's language", instead of real understanding. :-)
You probably know that one can teach some birds to use our words and phrases, but is it a real speech?

—SA
Albert Holguin 24-Jul-15 10:11am    
lol, that's a good one!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900