Sponsored Content
Full Discussion: Constructor problem
Top Forums UNIX for Dummies Questions & Answers Constructor problem Post 302087758 by woot4moo on Tuesday 5th of September 2006 12:52:30 PM
Old 09-05-2006
Constructor problem

Hi guys I am new to these forums but since I am taking a class at college I would appreciate any help that is possible for this program. My instructor said that when its complete the program should be able to store all 3 fields instead of just 1.

public class Greeter2Test
{
public static void main( String[] args)
{
Greeter terse = new Greeter ( "Hello, ", "Goodbye, ", "Dave" );
Greeter verbose = new Greeter ("How are you, ", "Have a nice day, ", "Hal");

System.out.println( terse.sayHello() );
System.out.println( verbose.sayHello() );
System.out.println( verbose.sayGoodbye() );
System.out.println( terse.sayGoodbye() );
}
}
Im not sure what it is that I am supposed to edit to make it work properly
The error I get is cannot find symbol. But I cant see which symbol it means or what exactly it is that I am misssing any help would be most appreciated.
 

7 More Discussions You Might Find Interesting

1. Programming

why constructor cannot be virtual

helo i read many books but i cant find the proper answer that why constructor cannot be virtual can u explain me in simple term that why constructor cannot be virtual Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

2. Programming

how do you handle a constructor and destructor that fail

helo i m new in c++ on linux can u tell me with an simple example that how do you handle constructor and destructor that fail? Regards, Amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

3. Shell Programming and Scripting

call constructor of java class in script

Hi, Is it possible to call the constructur of a java class in a shell script? I know you can call static methods, but can you also call the constructor? tnx. (1 Reply)
Discussion started by: thebladerunner
1 Replies

4. Programming

Doubt regarding Copy Constructor and return value

Hi All, I have made the simple following program :- #include <string> #include <iostream> using namespace std; class A{ private: int val; public : A(){cout<<"In A()"<<endl;} A (const A& aa) { cout<<"In copy c'tor"<<endl; } }; A f(... (1 Reply)
Discussion started by: shubhranshu
1 Replies

5. Programming

c++ object constructor question

I have the following code class Param{ public: Param(int aa, int bb){ a=aa; b=bb; } int a,b; }; void function(Param); int main(){ function(2,3); return 0; } (6 Replies)
Discussion started by: santiagorf
6 Replies

6. Programming

Doubts on C++ copy constructor concept

Hi, If I run the following program class A { public: A() { cout << "default" << endl; } A(const A&) { cout << "copy" << endl; } }; A tmp; A fun() { return tmp; } A test() { A tmp; cout << &tmp << endl; return tmp; } (1 Reply)
Discussion started by: royalibrahim
1 Replies

7. Programming

Constructor?

I am learning about C++ and today am reading concepts for Constructor but it seems a bit difficult to grab it fully. Please anyone explain in simple words about Constructor? (1 Reply)
Discussion started by: ggiwebsinfo
1 Replies
__gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _AllLibrary Functions__gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >(3)

NAME
__gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc > - SYNOPSIS
Inherits __gnu_pbds::basic_branch< Key, Mapped, Tag, detail::tree_traits< Key, Mapped, Cmp_Fn, Node_Update, Tag, _Alloc >::node_update, __gnu_cxx::typelist::create2< Cmp_Fn, detail::tree_traits< Key, Mapped, Cmp_Fn, Node_Update, Tag, _Alloc > >::type, _Alloc >. Public Types typedef Cmp_Fn cmp_fn typedef detail::tree_traits < Key, Mapped, Cmp_Fn, Node_Update, Tag, _Alloc > ::node_update node_update" Public Member Functions tree (const cmp_fn &c) template<typename It > tree (It first, It last) template<typename It > tree (It first, It last, const cmp_fn &c) tree (const tree &other) tree & operator= (const tree &other) void swap (tree &other) Detailed Description template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>, typename Tag = rb_tree_tag, template< typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update = null_node_update, typename _Alloc = std::allocator<char>>class __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc > A tree-based container. Template Parameters: Key Key type. Mapped Map type. Cmp_Fn Comparison functor. Tag Instantiating data structure type, see container_tag. Node_Update Updates tree internal-nodes, restores invariants when invalidated. XXX See design::tree-based-containersnode invariants. _Alloc Allocator type. Base tag choices are: ov_tree_tag, rb_tree_tag, splay_tree_tag. Base is basic_branch. Definition at line 635 of file assoc_container.hpp. Member Typedef Documentation template<typename Key , typename Mapped , typename Cmp_Fn = std::less<Key>, typename Tag = rb_tree_tag, template< typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update = null_node_update, typename _Alloc = std::allocator<char>> typedef Cmp_Fn __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >::cmp_fn Comparison functor type. Definition at line 642 of file assoc_container.hpp. Constructor &; Destructor Documentation template<typename Key , typename Mapped , typename Cmp_Fn = std::less<Key>, typename Tag = rb_tree_tag, template< typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update = null_node_update, typename _Alloc = std::allocator<char>> __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >::tree (const cmp_fn &c) [inline] Constructor taking some policy objects. r_cmp_fn will be copied by the Cmp_Fn object of the container object. Definition at line 648 of file assoc_container.hpp. template<typename Key , typename Mapped , typename Cmp_Fn = std::less<Key>, typename Tag = rb_tree_tag, template< typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update = null_node_update, typename _Alloc = std::allocator<char>> template<typename It > __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >::tree (Itfirst, Itlast) [inline] Constructor taking __iterators to a range of value_types. The value_types between first_it and last_it will be inserted into the container object. Definition at line 655 of file assoc_container.hpp. template<typename Key , typename Mapped , typename Cmp_Fn = std::less<Key>, typename Tag = rb_tree_tag, template< typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update = null_node_update, typename _Alloc = std::allocator<char>> template<typename It > __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >::tree (Itfirst, Itlast, const cmp_fn &c) [inline] Constructor taking __iterators to a range of value_types and some policy objects The value_types between first_it and last_it will be inserted into the container object. r_cmp_fn will be copied by the cmp_fn object of the container object. Definition at line 663 of file assoc_container.hpp. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Jun 10 2__gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >(3)
All times are GMT -4. The time now is 01:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy