What bugs me are the static const float declarations. First, even though they are in the class header file, they are not part of the class declaration. My first serious introduction to programming was VB.NET and C# and I am still confused with things being declared outside of classes. How is their scope defined? And what does the keyword static mean in this place?
"So, where's the democracy here, because that looks like dictatorship to me."
Then you need to find a dictionary.
You see Starmer has announced this however it is not a law until it's passed by parliament. So this whole dictatorship thing falls apart when you consider the correct procedure is being followed.
If I have to present some documentation to access a service to reduce the potential impact on children I have no issue with that. It was like the whole **** lock. If you have a real issue with it being made harder for kids to access **** because it's a little inconvenient I have concerns about you.
The illusion that the government need you to pass some digital ID law to monitor you shows pure ignorance to the sheer volume of data already out there.
Question
Andre S. Veteran
I was reading the Head First Design Patterns Silver C++ translation and came across this:
#ifndef _HFDP_CPP_VISITOR_INGREDIENT_HPP_ #define _HFDP_CPP_VISITOR_INGREDIENT_HPP_ namespace HeadFirstDesignPatterns { namespace Visitor { namespace Menus { // recommended daily values static const float dailyCalories = 2000.0f; static const float dailyCarbs = 300.f; static const float dailyCholesterol = 0.300f; static const float dailyFat = 65.0f; static const float dailyProtien = 50.0f; static const float dailySodium = 2.400f; class Visitor; class Ingredient : MenuComponent { protected: float _amount; protected: Ingredient( float amount = 1.0f ) : _amount( amount ) { assert( amount > 0.0f ); } public: virtual ~Ingredient() = 0 { } public: virtual void add( MenuComponent* menuComponent ) { } public: virtual void accept( Visitor* visitor ) = 0; public: virtual bool isVegetarian() const = 0; public: virtual float getCalories() const = 0; public: virtual float getCarbs() const = 0; public: virtual float getCholesterol() const = 0; public: virtual float getFat() const = 0; public: virtual float getProtien() const = 0; public: virtual float getSodium() const = 0; public: virtual float getHealthRating() const { float result = 0.0f; result += getCalories() / dailyCalories; result += getCarbs() / dailyCarbs; result += getCholesterol() / dailyCholesterol; result += getProtien() / dailyProtien; result += getSodium() / dailySodium; return _amount * ( result * 100.0f ); } public: virtual std::string toString() const = 0; }; } // namespace Menus } // namespace Vistor } // namespace HeadFirstDesignPatterns #endifWhat bugs me are the static const float declarations. First, even though they are in the class header file, they are not part of the class declaration. My first serious introduction to programming was VB.NET and C# and I am still confused with things being declared outside of classes. How is their scope defined? And what does the keyword static mean in this place?
Thanks.
Link to comment
https://www.neowin.net/forum/topic/651152-c-a-meaning-of-static/Share on other sites
10 answers to this question
Recommended Posts