Problem defining a struct


 
Thread Tools Search this Thread
Top Forums Programming Problem defining a struct
# 1  
Old 10-06-2011
Problem defining a struct

I have the following code and getting the compilation errors

Code:
baseLib/DynBaseObj.h:80: error: expected constructor, destructor, or type conversion before ‘(' token
baseLib/DynBaseObj.h:89: error: expected constructor, destructor, or type conversion before ‘(' token
baseLib/DynBaseObj.h:101: error: expected constructor, destructor, or type conversion before ‘(' token

Code:
///////////////////////////////////////////////////////////////////////////
//
//  --Module---------------------------------------------------------------
//
//                           <<struct> DynBaseObj
//
//                 Creates object with a value and a pointer.
//
//  --Attributes-----------------------------------------------------------
//
//  Value
//    + Value: T
//
//  Prev
//    + Prev: DynBaseObj*
//
//  Next
//    + Next: DynBaseObj*
//
//  --Operations-----------------------------------------------------------
//
//  DynBaseObj
//    + DynBaseObj(val: T)
//    + DynBaseObj(val: T, next: DynBaseObj*)
//    + DynBaseObj(val: T, prev: DynBaseObj*, next: DynBaseObj*)
//
//  --History--------------------------------------------------------------
//
//    V01 - DEC 1999 - Luca D'Auria
//          Initial release.
//    V02 - SEP 2008 - Luca Elia
//          Version fixed for g++ 4.3.0.
//    V03 - MAY 2009 - Christopher Dimech
//          Adopted C++ coding standards based on the IBM Standard C++
//          Library Reference Guide and the Ellementel Telecommunication
//          Systems Laboratory C++ Style Guide.
//    V04 - NOV 2009 - Luca D'Auria
//          Code changes after visit to RISSC-Lab.
//    V05 - JUL 2011 - Christopher Dimech
//          Adopted UML 2.3 for documenting class structure.
//
///////////////////////////////////////////////////////////////////////////

#ifndef DynBaseObj_H
#define DynBaseObj_H

#include <iostream>

#include "gendef.h"
#include "Vector.h"

// ***********************************************************************
// TEMPLATE CLASS: BaseObject
// ***********************************************************************

template <class T>
struct DynBaseObj {

    T  Value;

    DynBaseObj*  Prev;

    DynBaseObj*  Next;

    DynBaseObj(T  val);

    DynBaseObj(
      T  val,
      DynBaseObj*  next);

    DynBaseObj(
      T  val,
      DynBaseObj*  prev,
      DynBaseObj*  next);

};

//////////////////////////////////////////////////////////////////////////

DynBaseObj(T  val) {

  Value = val;
  Prev = Next = NULL;

}

//////////////////////////////////////////////////////////////////////////

DynBaseObj(
  T  val,
  DynBaseObj*  next) {

  Value = val;
  Prev = NULL;
  Next = next;

}

//////////////////////////////////////////////////////////////////////////

DynBaseObj(
  T  val,
  DynBaseObj*  prev,
  DynBaseObj*  next) {

  Value = val;
  Prev = prev;
  Next = next;

}

//////////////////////////////////////////////////////////////////////////

#endif

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Defining variable problem

Hi I'd say I'm having this weird problem where my script isn't taking the value off a variable or printing it. My code is like this: set count_C= `grep -c C mols` set count_H= `grep -c H mols` set count_O= `grep -c O mols` sed -i '7,7 s/$/ $count_C $count_O $count_H/g' input It... (8 Replies)
Discussion started by: saleheen
8 Replies

2. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies

3. Programming

Compiling virtual network adapter driver problem (net_device struct)

Hi, I found on linuxgazette.net/93/bhaskaran.html page very useful sample of virtual driver (not connected to real hardware). I try to compile it with no effect. So: I got fresh Ubuntu 9.10 (kernel 2.6.31-14) My source is saved in networkAdapter.c file in /usr/src/myModules directory. I... (21 Replies)
Discussion started by: Chrisdot
21 Replies

4. UNIX for Dummies Questions & Answers

How to access a struct within a struct?

Can someone tell me how to do this? Just a thought that entered my mind when learning about structs. First thought was: struct one { struct two; } struct two { three; } one->two->three would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies

5. Shell Programming and Scripting

alias defining problem in .cshrc file

Hi folks, I'm trying to define the following command as alias in .cshrc file: ls -ltr | grep ^d | awk '{print $9}' | xargs du -hs I defined it as the following: alias nirdirs '`ls -ltr | grep "^d" | awk "{print \\$9}" | xargs du -hs`' I've got the following error when I've run the alias:... (7 Replies)
Discussion started by: nir_s
7 Replies

6. UNIX for Advanced & Expert Users

problem with netfilter hook function struct skbuff *sock is null..

iam trying to built a firewall.so i have used netfilter for it. in function main_hook sock_buff is returning null and in my log file continuously "sock buff null" is printed plse help to solve this problem.. (using print_string iam printing strings on current terminal (terminal we ping)) ... (1 Reply)
Discussion started by: pavan6754
1 Replies

7. Solaris

Problem defining remote printers on solaris 10

Good morning, I have a server with solaris 10 that I want to intall remote printers. I started lpsched deamon without problems with command: svcadm enable application/print/server I want to install printers that are defined locally on print server, so: lpadmin -p <device> -s <print... (2 Replies)
Discussion started by: bonovox
2 Replies

8. Shell Programming and Scripting

Sorting/Filed Defining/Output problem

need a little help with a few tid bits. I wrote a script that checks the resoluion of image files and writes them out to a file then sorts the resolutions by largets Width. Then take the sorted files information and toss all the 835 widths into a seperate file. Ignore the redundancies its a... (1 Reply)
Discussion started by: TiredOrangeCat
1 Replies

9. Programming

Problem accessing struct member

I have a struct as follows... struct A { int a; ucontext_t X; //ucontext_t is another structure } How do I define a pointer to the above structure variable X of the type ucontext_t from within another function? eg. void foo() { struct A a; /////WHAT COMES IN... (1 Reply)
Discussion started by: jacques83
1 Replies

10. Programming

struct tm problem

I receive an integer as argument for a function. within function definition i want it to be of type struct tm. eg.. main() { int a; ...... } function(...,..,a,..) int a; { struct tm tm; if(!a) ^ time(&a); ^ ... (4 Replies)
Discussion started by: bankpro
4 Replies
Login or Register to Ask a Question