Windows Develop Bookmark and Share   
 index > Windows Forms General > Basic doubt about the class and instantiation details!
 

Basic doubt about the class and instantiation details!

I have Basic doubt about the class and instantiation details, though I am writing such code.

In my windows forms application, I have two classes inside a namespace.

Namespace=testnamespace

class1 = myform, file=myform.h

class2= mybutton, file=mybutton.h

even though they are under the same namespace (=testnamespace), if I want to instantiate mybutton in myform, I need to #include "mybutton.h" in the top.

Why do I need to include eventhough they belong to same namespace.

I have around 15 classes, as of date, and I find it a hassle. Instead, is there any setup to uniformly call the other classes within same namespace?

in myform.h, If I give

private: testnamespace::mybutton* _mybutton;

it does not accept until I include the *.h file.

Please refer me to sample readme pages or related pages, that may help me understand the basic concepts.

Thanks in advance,

J A Y  Thursday, October 05, 2006 2:00 AM

Well, Jil.

namespace is a very simple thing which cansimplify the type name, for example, you don't need to type System.Windows.Forms.form every time if you import the System.Windows.Forms via using keyword. It's not a very big deal at all.

A namespace can contain serval files.

If you want to instantiate a class, the class defination is necessary.

gqlu  Tuesday, October 10, 2006 8:39 AM

Well, Jil.

namespace is a very simple thing which cansimplify the type name, for example, you don't need to type System.Windows.Forms.form every time if you import the System.Windows.Forms via using keyword. It's not a very big deal at all.

A namespace can contain serval files.

If you want to instantiate a class, the class defination is necessary.

gqlu  Tuesday, October 10, 2006 8:39 AM
gqlu,Thanks a lot
J A Y  Tuesday, October 17, 2006 12:16 AM

You can use google to search for other answers

Custom Search

More Threads

• Show data in ListBox
• DataGridView WrapMode Broken w/o Spaces
• Which textbox is the cursor presently in?
• Maximize Form
• What's wrong with that code?
• how to know an actual size of a character(in pixel) at a specified font ?
• WebBrowser Object and LoaderLock
• Child Form Location Problem
• Getting a component's owner form?
• printing out of a richtextbox control