473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Declaration of s specific return-type of method, outside the class-definition. How ?

How do i declare a method that returns a doublepointer to a subclass, outside the Class-definition ?

That is, as of now I have
Expand|Select|Wrap|Line Numbers
  1. Class House
  2. {
  3.      ...
  4.      ...
  5.      Class Room
  6.      {
  7.          ...
  8.       }
  9.  
  10.       Room** myfunction(args)
  11.      {
  12.         Room **foo;
  13.         ...
  14.        return foo;
  15.      }
  16. }
  17.  
I would like to be able to move the myfunction outside the class-definition as usual; according to
Expand|Select|Wrap|Line Numbers
  1. Room** House::myfunction(args)
  2. {
  3.      Room **foo
  4.      ...
  5.      return foo;
  6. }
  7.  
But the compiler complains.

How do you write the declarations when it is not some of the traditional return types as void, int, float etc. ?
Jun 17 '07 #1
2 1811
JosAH
11,448 Expert 8TB
How do i declare a method that returns a doublepointer to a subclass, outside the Class-definition ?

That is, as of now I have
Expand|Select|Wrap|Line Numbers
  1. Class House
  2. {
  3.      ...
  4.      ...
  5.      Class Room
  6.      {
  7.          ...
  8.       }
  9.  
  10.       Room** myfunction(args)
  11.      {
  12.         Room **foo;
  13.         ...
  14.        return foo;
  15.      }
  16. }
  17.  
I would like to be able to move the myfunction outside the class-definition as usual; according to
Expand|Select|Wrap|Line Numbers
  1. Room** House::myfunction(args)
  2. {
  3.      Room **foo
  4.      ...
  5.      return foo;
  6. }
  7.  
But the compiler complains.

How do you write the declarations when it is not some of the traditional return types as void, int, float etc. ?
Room is a class in the scope of the House class so outside your class definitions
it would be this:

Expand|Select|Wrap|Line Numbers
  1. House::Room** House::myfunction( ...) // etc
  2.  
(I didn't look closely though, so I could be wrong; it's Sunday ;-)

kind regards,

Jos
Jun 17 '07 #2
Ahh ok. Thanks, that worked !
Jun 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Alex Vinokur | last post by:
=========== Windows 2000 Intel C++ 8.0 =========== ------ foo.cpp ------ int main () { for (int i = 0; i < 10; i++); for (int i = 0; i < 10; i++);
1
by: Barbara Alderton | last post by:
I have the following scenario: I have a user control that contains a registered menu control. The menu and other information on the user control is specific to the user accessing the site. ...
7
by: vasudev.v | last post by:
Hi All, I have one program, it links to two libraries. There is a variable with a same name in two different libraries. Compiler gives multiple declaration of same variable error. Please let...
5
by: Christian Christmann | last post by:
Hi, in one file I've a function that is used by another file containing the main function: file1.c: .... void test( int a ) { ... } ....
18
by: sunny | last post by:
Hi Why does C allows declaration of variable inside switch block. ex: foll prg does not gives "undeclared "b" error msg. but also does not initialize b to 20 int a=1; switch(a) { int b=20;...
2
by: Jeff Kish | last post by:
Hi. I'm stuck using a very old c++ compiler, and I'm trying to figure out how to add a declaration so that an algorithm can be used. This is really a compiler specific problem, however I was...
4
by: emailscotta | last post by:
Below are some over simplified examples of code the create a single instance of an object and I was hoping some one could give me the pros and cons of each approach. First declaration: In this...
4
by: the_init | last post by:
Hi friends, Can you please explain me why the following code prints 10, instead of 20 - Here I am little confused with the static and global declaration of i in the same program. ...
11
by: Matthias Pfeifer | last post by:
Hi there, I am trying to declare a function that takes a std::list<parameter. I want this function to have an empty list as a default parameter. It's a template function also. Currently i am...
14
by: subramanian100in | last post by:
Consider the following program: #include <iostream> using namespace std; int main() { int i;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.