Click here to Skip to main content
15,886,137 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: base class operations don't call derived class operations [modified] Pin
toxcct29-May-06 5:04
toxcct29-May-06 5:04 
AnswerRe: base class operations don't call derived class operations Pin
Niklas L29-May-06 5:13
Niklas L29-May-06 5:13 
GeneralRe: base class operations don't call derived class operations Pin
boogalo7929-May-06 5:31
boogalo7929-May-06 5:31 
GeneralRe: base class operations don't call derived class operations Pin
G Haranadh29-May-06 7:46
G Haranadh29-May-06 7:46 
AnswerRe: base class operations don't call derived class operations [modified] Pin
Stephen Hewitt29-May-06 13:52
Stephen Hewitt29-May-06 13:52 
GeneralRe: base class operations don't call derived class operations [modified] Pin
Member 303984329-May-06 23:07
Member 303984329-May-06 23:07 
QuestionProblem Reciving data in ftp using winsock [modified] Pin
darkcloud.42o29-May-06 3:38
darkcloud.42o29-May-06 3:38 
QuestionInheritance issue [modified] Pin
big_denny_20029-May-06 3:22
big_denny_20029-May-06 3:22 
hello Smile | :)

I've found my silly mistake

please help me find error in my code :

// *************
class Base
{
	public : 

 		virtual ~Base() {};

		// Retrieve value of X
		virtual void getX() const
		{
			cout<<endl<<"Inside Base : "<<m_X<<endl;
		};

protected : 
		int	m_X;
};

// *************
class Derived1 : public Base
{
public : 
	
	// Constructor
	Derived1()
		:Base()
	{
		m_X = 100;
	};

	// Retrieve value of X
	virtual void getX() const
	{
		cout<<endl<<"Inside Derived1 : "<<m_X<<endl;
	};
};
 
// *************
int _tmain(int argc, _TCHAR* argv[])
{
	try
	{
	throw Derived1(); 
	}

	catch (Base *pError) // should be &pError here
	{
		pError->getX(); // and .getX() here 
	}

	return 0;
}



sorry for stupid question

I am pretty tired, need a good sleep Smile | :)

-- modified at 9:42 Monday 29th May, 2006
AnswerRe: Inheritance issue [modified] Pin
toxcct29-May-06 3:26
toxcct29-May-06 3:26 
GeneralRe: Inheritance issue [modified] Pin
big_denny_20029-May-06 3:30
big_denny_20029-May-06 3:30 
GeneralRe: Inheritance issue [modified] Pin
toxcct29-May-06 3:36
toxcct29-May-06 3:36 
GeneralRe: Inheritance issue Pin
Cedric Moonen29-May-06 3:43
Cedric Moonen29-May-06 3:43 
GeneralRe: Inheritance issue Pin
Sarath C29-May-06 3:46
Sarath C29-May-06 3:46 
GeneralRe: Inheritance issue Pin
Sarath C29-May-06 3:45
Sarath C29-May-06 3:45 
AnswerRe: Inheritance issue Pin
Sarath C29-May-06 3:38
Sarath C29-May-06 3:38 
GeneralRe: Inheritance issue Pin
Stephen Hewitt29-May-06 14:32
Stephen Hewitt29-May-06 14:32 
AnswerRe: Inheritance issue [modified] Pin
Stephen Hewitt29-May-06 14:37
Stephen Hewitt29-May-06 14:37 
QuestionContext Menu - Adding an Item in the Windows explorer context menu Pin
Tamal Saha29-May-06 3:11
Tamal Saha29-May-06 3:11 
AnswerRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
toxcct29-May-06 3:16
toxcct29-May-06 3:16 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
Owner drawn29-May-06 17:37
Owner drawn29-May-06 17:37 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
toxcct29-May-06 21:22
toxcct29-May-06 21:22 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
Owner drawn30-May-06 21:12
Owner drawn30-May-06 21:12 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
toxcct30-May-06 21:39
toxcct30-May-06 21:39 
QuestionC++/CLI Pin
Sarath C29-May-06 3:10
Sarath C29-May-06 3:10 
AnswerRe: C++/CLI Pin
toxcct29-May-06 3:13
toxcct29-May-06 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.