Thread: inheretance: class problem

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    222

    inheretance: class problem

    hi,


    I have a very basic problem regarding inheretance. The situation is: there are two classes

    Code:
    template <typename Vec, typename Tint>
    class one {
    
      public:
        one();
    }:
    
    template <typename Vec, typename Tint>
    one<Vec,Tint>::one(){}
    
    template<typename S>
    class two: public one{
      
      public:
    
        two();
    
    };
    
    template<typename S>
    two<S>::two(){}

    what I get whan I try to compile it is the error refering to line
    Code:
    "class two: public one{"
    :

    Code:
    error: expected class-name before ‘{’ token
    ecerything is in the same file so I guess i am calling class one in the wrong way. What should be the proper construct for this

    thnx

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    one expects two template parameters, but you did not specify them.

    class two: public one<T1, T2>

    Replace T1 and T2 with the exact types you want.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another c++ class problem,
    By program in forum C++ Programming
    Replies: 5
    Last Post: 09-14-2011, 08:46 AM
  2. Problem with class/derived class
    By ammochck21 in forum C++ Programming
    Replies: 2
    Last Post: 04-07-2007, 12:40 AM
  3. Replies: 27
    Last Post: 10-11-2006, 04:27 AM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. pointers, arrays, and inheretance....C++
    By SneaksieBum in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 01:03 AM