473,903 Members | 6,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: insufficient contextual information to determine type

I have created a class that contains an instance of a second class.
When i try to call a member function of the instance of the second class
from a member function of the containing class, I get the following
error message:

Insufficient contextual information to determine type.

I have generated the simplest sample I could come up with that
duplicates this error, and it is attached below. I am fairly new to
programming and hope that I am not wasting anyone's time with this, but
I have been searching the net and my reference texts for the past three
hours trying to figure it out and am completely frustrated. It must
have something to do with the second class being user defined, because
if I substitute a string object I have no problem manipulating it.
Please help!

Sample code:

#include <iostream>

using std::cout;

class FirstClass {

public:
FirstClass();
void setFirstClassVa lue( int );

private:
int firstClassValue ;
};

FirstClass::Fir stClass()
{
firstClassValue = 7;
}

void FirstClass::set FirstClassValue ( int newValue )
{
firstClassValue = newValue;
}

class SecondClass {

public:
SecondClass();

private:
FirstClass instanceOfFirst Class();
};

SecondClass::Se condClass()
{
instanceOfFirst Class.setFirstC lassValue( 10 ); //The problem line

};
main()
{
SecondClass instanceOfSecon dClass();

Return 0;
}
Jul 23 '05 #1
2 16186
Squid Seven wrote:

private:
FirstClass instanceOfFirst Class();


This doesn't do what you think it does. This declares a private member
function called instanceOfFirst Class that takes no arguments and returns
(by value) a FirstClass object. I think what you probably want here is:
private:
FirstClass instanceOfFirst Class;
Jul 23 '05 #2
Thankyou very much - that did resolve the problem.

Phil Staite wrote:
Squid Seven wrote:

private:
FirstClass instanceOfFirst Class();

This doesn't do what you think it does. This declares a private member
function called instanceOfFirst Class that takes no arguments and returns
(by value) a FirstClass object. I think what you probably want here is:
private:
FirstClass instanceOfFirst Class;

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5047
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
19
3795
by: Christopher | last post by:
I am getting a parse error from g++ pointing at my catch line and can't figure out whats wrong with this code: #include "BigPosInt.h" #include <iostream> #include <new> #include <assert.h> BigPosInt::BigPosInt(int init_max_digits) {
3
1601
by: Robert Neville | last post by:
I am looking for JavaScript examples on expanding contextual definition. For example, you have a word like POP3 and the user click on the word expanding it with the following contextual definition. POP3 (POP3: A common protocol that is used to retrieve e-mail messages from an Internet e-mail server.) Sites like Microsoft use the technique throughout their site. I hope to find the code and an explanation on its usage. Let me know if you...
5
1971
by: hpy_awad | last post by:
I wrote that example from a book and there is en error in the display module that it does not showing all the records are entered in the input module. I traced with some printf statments without getting the solution . I think the error in the display module loop condition. Thanks #include <stdio.h>
4
6868
by: Sagaert Johan | last post by:
i get this error if i write this : using System.Net.Sockets; .... .... TcpClient tcp; tcp=new TcpClient();
2
14422
by: Chris Fink | last post by:
I am using the System.IO.File class to determine if a file exists on a network share. The File.Exists method keeps returning false, even though the file does exist. The MSDN documentation states, "If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns false regardless of the existence of path."
669
26441
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
12
1752
by: Wilson | last post by:
Hi, while writing a simplified version of a program i created the following class, however when i went to compile and run the program there was an error saying "multiple types in one declaration" and there was a mention of a "" and "Error 1" it also highlights the final line (the one with a closing brace and semi-colon), i cannot see what is wrong with this, please help
2
1968
by: Vinay Sajip | last post by:
Some users of the logging package have raised an issue regarding the difficulty of passing additional contextual information when logging. For example, the developer of a networked application may want to log, in addition to specifics related to to the network service being provided, information about the IP address of the remote machine and the username of the person logged into and using the service. Python 2.4 introduced an 'extra'...
0
10006
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
1
10990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10504
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7215
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5899
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4316
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3329
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.