From 531d6d070827ba95a30dc2ddee85cea228f17461 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 5 Jul 2001 07:52:02 +0000 Subject: [PATCH] Add constructors to classes, where C++ requires us to do so. git-svn-id: https://svn.dealii.org/trunk@4817 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-4/step-4.cc | 15 +++++++++++++++ deal.II/examples/step-5/step-5.cc | 7 +++++++ deal.II/examples/step-6/step-6.cc | 2 ++ deal.II/examples/step-7/step-7.cc | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/deal.II/examples/step-4/step-4.cc b/deal.II/examples/step-4/step-4.cc index 893a55f477..1998d4dfc2 100644 --- a/deal.II/examples/step-4/step-4.cc +++ b/deal.II/examples/step-4/step-4.cc @@ -124,10 +124,23 @@ class LaplaceProblem // side with only one parameter, // namely the point where we want to // evaluate the function. + // + // Note that the C++ language forces + // us to declare and define a + // constructor to the following + // classes even though they are + // empty. This is due to the fact + // that the base class has no default + // constructor (i.e. one without + // arguments), even though it has a + // constructor which has default + // values for all arguments. template class RightHandSide : public Function { public: + RightHandSide () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; }; @@ -138,6 +151,8 @@ template class BoundaryValues : public Function { public: + BoundaryValues () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; }; diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index 4ebba492a3..dbe1414ac9 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -98,10 +98,17 @@ class LaplaceProblem // information from the ``value'' // function as well will be explained // below when assembling the matrix. + // + // The need to declare a seemingly + // useless default constructor exists + // here just as in the previous + // example. template class Coefficient : public Function { public: + Coefficient () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; diff --git a/deal.II/examples/step-6/step-6.cc b/deal.II/examples/step-6/step-6.cc index c0e2ede8cd..71bbe914e6 100644 --- a/deal.II/examples/step-6/step-6.cc +++ b/deal.II/examples/step-6/step-6.cc @@ -140,6 +140,8 @@ template class Coefficient : public Function { public: + Coefficient () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; diff --git a/deal.II/examples/step-7/step-7.cc b/deal.II/examples/step-7/step-7.cc index c8bbcc6337..0f13486717 100644 --- a/deal.II/examples/step-7/step-7.cc +++ b/deal.II/examples/step-7/step-7.cc @@ -180,11 +180,19 @@ const double SolutionBase::width = 1./3.; // respective virtual member // functions in the ``Function'' base // class. + // + // Just as in previous examples, we + // are forced by the C++ language + // specification to declare a + // seemingly useless default + // constructor. template class Solution : public Function, protected SolutionBase { public: + Solution () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; virtual Tensor<1,dim> gradient (const Point &p, -- 2.39.5