Compiles fine. But at runtime it gives ClassCastException. My doubt is that why is it so even though st which is of type Sample1 gets casted to Sample2 and generates exception even though Sample2 IS-A Sample1.
rahul.ch 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
rahul.ch 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
rahul.ch 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.