473,320 Members | 1,856 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,320 software developers and data experts.

Why it does not compile?

#include <iostream.h>
#include <string>
#define BUFSIZE 128 /*Constant using macro –no checking type*/

using namespace std; /*standard container class*/

class person{
public: /*Default constructor */
char *surname, *givename, *address, *birthday; /*also another
solution by switching completely to initializer lists, using
std::string instead of char*,using namespace std.*/
person(); /*definiton of person*/
person(char *sn, char *gn, char *addr, char *bDay){
surname=sn;
givename=gn;
address=addr;
birthday=bDay;
}
/*show new name*/
void nameChange(char *sname, char *gname){
surname=sname;
givename=gname;
cout<<"Name has been changed"<<endl;
}
/*show new address*/
void addrChange(char *addr){
address=addr;
cout<<"Address has been changed"<<endl;
}
/*show surname and givename*/
void showName(){
cout<<"Surname: "<<surname<<endl;
cout<<"Givename: "<<givename<<endl;
}
/*show addres*/
void showAddr(){ /*show addres*/
cout<<"Address: "<<address<<endl;
}
person(){}; /*recalls the properties of person*/
};
/*Student inherits form person*/
class student:public person{
private:

int studentNo; /*define student number as int*/
/*Student contructor*/
public:

student(char *sn, char *gn, char *addr, char *bDay, int sNo) /*also
changes to the construcotr stundent(const string &,const string
&,const string &,const string &,const int&);*/
:person(sn,gn,addr,bDay){
studentNo=sNo;
}
void showStudentNo(){
cout<<"Sudent No: "<<studentNo<<endl; /*also here could have been
optimised std::cout << "Student No: " << studentNo << std::endl:*/
}
};

int main(){

cout<<"----------person----------"<<endl;
person p1=person("Fausto", "Rstom", "YO-KYLA 2D 29", "06.02.73");
p1.showName();
p1.nameChange("Fausto","Rstom");
cout<<"Show name agian!"<<endl;
p1.showName();
cout<<"Show address!"<<endl;
p1.showAddr();

cout<<"---------student------------"<<endl;
student s1=student("Gherici", "Constantin", "Nostovaenkatu 20 as 13",
"21.05.73", 12345);
s1.showName();
s1.showStudentNo();
s1.showAddr();
s1.addrChange("Yo-kyla 10A 23");
cout<<"Show address agian!"<<endl;
s1.showAddr();
return 0;
}
Jul 22 '05 #1
2 1479

"Constant" <co*******@yahoo.com> wrote in message
news:5c**************************@posting.google.c om...
#include <iostream.h>
#include <string>
#define BUFSIZE 128 /*Constant using macro -no checking type*/

using namespace std; /*standard container class*/

class person{
public: /*Default constructor */
char *surname, *givename, *address, *birthday; /*also another
solution by switching completely to initializer lists, using
std::string instead of char*,using namespace std.*/
>>>> person(); /*definiton of person*/

Remove the above line. You are providing the constructor definition later within
the body of class.
btw, this is a declaration and not a definition.

-Sharad
Jul 22 '05 #2
Thanks for your help..your right..Sharad
Jul 22 '05 #3

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
8
by: Douglas | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** Hello, The following code does not compile if line 3 is uncommented "using namespace std". I do not understand it. Could...
4
by: Alex Vinokur | last post by:
Compiler GNU gpp.exe (GCC) 3.4.1 Foo(300) = Foo(500); // Foo(300) is const. Why does a compiler compile that? ------ foo.cpp ------ struct Foo { explicit Foo(int) {}
5
by: Genboy | last post by:
My "VIS" Website, which is a C# site created in VS.NET, Framework 1.1, is no longer compiling for me via the command line. As I have done 600 times in the last year and a half, I can compile to...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
9
by: ziman137 | last post by:
Hi all, The results from following codes got me a bit confused. #include <stdio.h> #include <iostream> using namespace std; struct A {
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
55
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in...
11
by: MonkeeSage | last post by:
A quick question about how python parses a file into compiled bytecode. Does it parse the whole file into AST first and then compile the AST, or does it build and compile the AST on the fly as it...
5
by: Jeff | last post by:
hi asp.net 2.0 I get this compile error: 'Image' does not contain a definition for 'ImageUrl' Image image = (Image)e.Item.FindControl("img"); image.ImageUrl = "~/image.png";
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.