|
Nelek wrote: intermediate advance
I did understand this as meaning "I know programming, so noone needs to tell me about the difference between while and do..until ".
This rules out the vast majority of net-tutorials.
But he did not ask for special topics, so I gave him books every C++-Programmer should have read (The Myers!) and books showing the basics of the MFC-Platform.
For the special topics, he would need to google (after he has read the articles here!
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Some books I use almost dayly, numbered with your topic numbers:
All of these are some kind of timeless classics.
1) Scott Myers, Effective C++
Scott Myers, More Effective C++
4) Jeff Prosise, Programming Windows with MFC
Charles Petzold, Programming Windows
5) Nicolai Josuttis, The C++ Standard Library
Scott Myers, Effective STL
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
On the light side:
1.Select your book by weight!
2.Avoid "cut and paste" books with lots of pictures!( See item 1 )
3.Go to your local library.
4.Check educational institutions for courses study materials.
5.Go to local bookstore AFTER you narroved down the subject of your interest.
6.No matter what you selected - finish it first!
7.Make bookmarks and notes in YOUR book only!
|
|
|
|
|
class Fred;<br />
<br />
class FredBase {<br />
private:<br />
friend class Fred;<br />
FredBase() { }<br />
};<br />
<br />
class Fred : private virtual FredBase {<br />
public:<br />
...<br />
};
How does the above piece of code ensure that the class is non derivable?
|
|
|
|
|
tom groezer wrote: How does the above piece of code ensure that the class is non derivable?
It doesn't.
Can you explain, what you want to know ?
Prasad
MS MVP - VC++
|
|
|
|
|
There are two principles involved.
1. A friend class can access all members of the host class including private members. So Fred class will be able to access the constructor of FredBase.
2. The constructor of a virtual base class (FredBase) is always called by the most derived class. So if a new class is being derived from Fred, that new class will be the one calling the constructor of FredBase. This will fail as the constructor is private.
The error can be seen only when an object of the newly derived class is created as that is where the constructor call happens.
« Superman »
|
|
|
|
|
What is meant by operator functions? This is nothing to do with operator overloading. It has something to do with explicit conversions. This was a question that was asked by someone.
|
|
|
|
|
I haven't heard of operator functions but related to explicit conversions are conversion functions
(aka conversion operators, casting operators).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Something like the operator LPCTSTR() that CString uses?
But this is about *implicit* conversion.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
|
Vaclav_Sal wrote: If you build a new view class in MFC you end up with missing pieces - no GetDocument is a prime example. Private constructor and destructor other hindrance.
I thought this was the way it's always been.
GetDocument() is already declared/defined in the base class. There's no reason for
your derived class to have another one.
Constructor/destructor are private because views aren't meant to be created
directly.
Welcome to MFC Doc/View If you follow the rules, it works fine.
For custom functionality, study the MFC source code carefully!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Mmm,
"However, after adding the newly created view class in doc/view template it cannot be used until the constructor is made public."
Im not agree with that. I have a multiview project MainView is CScrollView derived and there are 3 SecViews template from CForm derived but I can have up to 49 Views opened at the same time. The constructors of my SecondaryViews are still protected.
For the problem with the GetDocument (), it is easy to implement a trick. I use GetDocument ONLY in my MainView but I can access to the document from ALL the classes I have implemented (more than 50), it doesn't matters if they are View-derived or Object-derived or another parent class.
By printing from secondary views you don't get it easly with the assistant but you can add it manually and works perfectly.
If u need some examples about ask for
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Vaclav_Sal wrote: However, after adding the newly created view class in doc/view template it cannot be used until the constructor is made public.
You never, ever construct views using their constructor.
This is done by the FrameWnd or the SplitterWnd containing it using IMPLEMENT_DYNCREATE .
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Vaclav_Sal wrote: if I add this new class via Gallery
I don't know what you mean by 'Gallery', but normally, views are created by a (class derived from) CFrameWnd or a CSplitterWnd by calling CreateView() . Most often in OnCreateClient().
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
|
I have an application that writes to the registry to start itself on startup, but I need some function to get the application path. Anyone have any ideas?
Thanks in advance.
|
|
|
|
|
|
Great! Thanks a lot for that suggestion. I looked at it on MSDN, and there's only a small problem left. I am using a CString named path to store the path, and so for the buffer I used path.GetBuffer(0) like ::GetModuleFileName(NULL,path.GetBuffer(0),sizeof(path.GetBuffer(0))); . Unfortunately, the path, no matter what my executable is named, is C:\Dstrcore.cpp. Any clue as to what's going on? I suspect that it's something to do with the CString.
Also, is there any other way to get a buffer of modifyable length like the CString method GetBuffer? char* doesn't seem to work for me...I have to initialize it like path=new char [10], but I don't know how many characters the path will be...CString helps by null terminating the string and also by having a buffer of modifyable length...If anyone can figure out how to do this with a char*, I'd be really grateful.
Thanks again.
|
|
|
|
|
|
hxhl95 wrote: ...I used path.GetBuffer(0) like ::GetModuleFileName(NULL,path.GetBuffer(0),sizeof(path.GetBuffer(0)));.
Since GetBuffer() returns a pointer, you are passing 4 as the third argument to GetModuleFileName() . Try:
GetModuleFileName(NULL, path.GetBuffer(MAX_PATH), MAX_PATH);
path.ReleaseBuffer();
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What's MAX_PATH? Never heard of it before
|
|
|
|
|
hxhl95 wrote: What's MAX_PATH?
See here[^], and also check your Include folder.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How does a conversion operator works ?
Why it is created with overloading keyword "operator" ?
Why it does not have a return type, while with the "operator" keywork we have to have mention a return type ????
Please, all the gentlemen here, help me, i am trying to hone my C++ programming skills to a good level.
|
|
|
|
|
Zealous_Me wrote: i am trying to hone my C++ programming skills to a good level.
Why do you think forum based messages are an appropriate way to do that?
IMHO you would be better served working some tutorials and/or reading some books.
|
|
|
|