|
OK, thats nice explanation..
one more issue comes into my mind.
A
/ \
B C
\ /
D
In the same diamond structure if my declaration is like:
class A;
class B : virtual public A;
class C : virtual public A;
class D : public B, public C;
now when i do
A *d = new D; //it will work as ambiguity is removed by virtual.
But, which path will be followed??
A->B->D or A->C->D??
or something else...
|
|
|
|
|
laksh2204 wrote: A *d = new D; //it will work as ambiguity is removed by virtual.
But, which path will be followed??
A->B->D or A->C->D??
Now your output will be
A
B
C
D
I guess first base class gets the preference.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
This is due to the fact that the base class constructor has to get called before the derived class constructor gets call. since D derives from both B and C constructor of A gets called in either of the cases
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Hi Friends,
I want to run a VB Script in a button click event.
This VB Script is defined in the program itself.
Could anyone tell me how to run the script.
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
|
Hi All
Can i add EditControl through code.if yes then plz help me..
|
|
|
|
|
|
Thx's it is working..Can i show new edit as a visible false..
|
|
|
|
|
MsmVc wrote: Can i show new edit as a visible false
|
|
|
|
|
MsmVc wrote: Can i show new edit as a visible false..
No. Setting the Visible property to false means you want the window to be hidden, not shown. Now, are you wanting to show or hide the window? Perhaps the removal or inclusion of the WS_VISIBLE style is what you are after.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
OR you can use of ShowWindow(SW_HIDE).
|
|
|
|
|
This link[^] seems helpful.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Or you can use of CreateWindow.
|
|
|
|
|
How can i add variable of edit control when i am useing this one
void CMyView::OnInitialUpdate() <br />
{<br />
CView::OnInitialUpdate();<br />
<br />
CEdit* pEdit = new CEdit;<br />
pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,<br />
CRect(10, 10, 100, 100), this, 1);<br />
}
Plz help me
|
|
|
|
|
|
Of course you must be declare your variable outside of a function.
|
|
|
|
|
Hi all!
I have the following class and i want a way to make the tree, and edit controls to have access to MAINCLASS variables.
a. Is that OK to create a constructor to each one of the controls to pass a parameter something like
Window* wn;
And use it as ((MAINCLASS *)mainwindow)->a; within class implementation ?
Or can you suggest me an other OOP way because i have read somewhere that this way to convert a base class object (mainwindow) to a derived class object is not so legal?
class MAINCLASS: public window
{
...
...
public:
//constructor
//destructor
MyTreeCtrl tc;
MyEditCtrl ec;
...
...
public:
// Variables
int a;
}
a.
// in MyTreeCtrl h
class MyTreeCtrl
{
...
...
public:
MyTreeCtrl(Window* wn)
void Foo();
...
...
public:
// Variables
Window *mainwindow;
};
// in MyTreeCtrl cpp
MyTreeCtrl::MyTreeCtrl(Window* wn)
{
mainwindow = wn;
}
MyTreeCtrl::void Foo()
{
...
int b = ((MAINCLASS *)mainwindow)->;a
...
}
Thanks!
|
|
|
|
|
one suggestion (Off Topic) : Please use code block tags for posting code. Also indent the code so it is readable.
Now about the topic.
You can use forward declaration to solve your problem.
Check this link for example : Forward declaration[^]
Regards,
Sandip.
|
|
|
|
|
Hi All
I want to set OS directory in editbox.i want to set OS directory name when my application is run.Plz help me
|
|
|
|
|
cant understand what you want?
you want to fetch os directory like
"C:\windows" or what? and set it to edit control
|
|
|
|
|
yes i want to set "C:\windows" in edit control..
Plz help me
|
|
|
|
|
GetSystemDirectory()
u can use.
SetDlgItemText for set text in Edit Control.
u can use GetWindowsDirectory() also but in xp and next it gives folder
with user name so better to use GetSystemDirectory() and extract from it.
Enjoy.![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
Use SetWindowText() (documentation here) to set the text in the edit control.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
char lpBuffer[MAX_PATH];
UINT len = GetWindowsDirectory(lpBuffer,MAX_PATH);
SetWindowText(hWndEdit,lpBuffer);
cheers
Varghese Paul
|
|
|
|