Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How can I call an enclosing class's function?
Hi All,

I have a class, ConsoleWindow, that is a member of another class,
ConsoleLib, like so:
class ConsoleLib
{
public:
class ConsoleWindow
{
public:
ConsoleWindow(HANDLE Screen, COORD Start, COORD Size, bool Border);
~ConsoleWindow();
// etc.
}
void OutputString(char *String);
// etc.
}
How would I call a ConLib function from a ConsoleWindow constructor or
function?  I'm trying to call OutputString from ConsoleWindow's constructor.
Is there any way of doing this?

On a side note, should the subclass ConsoleWindow be public or private?

Thanks,
Eric



Report this thread to moderator Post Follow-up to this message
Old Post
Eric A. Johnson
03-26-05 08:59 AM


Re: How can I call an enclosing class's function?
Use "ConsoleWindow::OutputString()".

Make ConsoleWindow private, then add public accessor-methods to
ConsoleLib to retrieve information from ConsoleWindow.



"Eric A. Johnson" <nothere@dontlookforme.com> wrote in message
news:ks31e.15551$C47.5018@newssvr14.news.prodigy.com...
> Hi All,
>
>     I have a class, ConsoleWindow, that is a member of another class,
> ConsoleLib, like so:
> class ConsoleLib
> {
> public:
>     class ConsoleWindow
>     {
>     public:
>         ConsoleWindow(HANDLE Screen, COORD Start, COORD Size, bool
Border);
>         ~ConsoleWindow();
>         // etc.
>     }
>     void OutputString(char *String);
>     // etc.
> }
> How would I call a ConLib function from a ConsoleWindow constructor or
> function?  I'm trying to call OutputString from ConsoleWindow's
constructor.
> Is there any way of doing this?
>
> On a side note, should the subclass ConsoleWindow be public or private?
>
> Thanks,
> Eric
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Kelly
04-01-05 01:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Studio archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:49 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.